37
HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 1 Hong Kong Examination and Assessment Authority Hong Kong Advanced Level Examination 2012 ASL Computer Application Paper 2 Name : Chu Hung Wing Class : 7A (13)

Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 1

Hong Kong Examination and Assessment Authority

Hong Kong Advanced Level Examination 2012

ASL Computer Application Paper 2

Name : Chu Hung Wing

Class : 7A (13)

Page 2: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 2

Content

Objective Page

Title of Assignment 4

Background 5

Introduction of a discussion forum 6

How can the database help us to design a forum system? 7

Analysis

User statistics 8

Posting statistics 9

Online traffic analysis 9-10

Posting habits analysis 10

Analysis of database system software 11

Conclusion 12

Design

Terminology and Notation of Entity Relationship Modeling 13-14

Application of the ERD in the discussion forum system 15-16

3 Examples of relationships between users and news 17-18

Data Schema 18

Page 3: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 3

Implementation

Collection of data 19-20

Generating User statistics 21-22

Generating Posting statistics 22

Generating Online traffic analysis 23

Generating Posting habit analysis 24

Data Validity 25-26

Testing and Evaluation

Testing plans table 27

Testing plan 1 28-29

Testing plan 2 30

Testing plan 3 31

Testing plan 4 32

Conclusion and Discussion 33-35

Documentation 36

Working Schedule 37

Page 4: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 4

Objective

1. Title of Assignment1

Candidates should complete one of the following assignments. Candidates should

develop a prototype of the application to demonstrate the design.

Title 1 : Discussion Forum System

Candidates are required to design a public discussion forum system in which a

database is used to store user information and forum posts.

Essential information about each post, such as the user identifier, IP

address and time of the post, should be stored for security and user behaviour analysis

purposes.

The system should generate statistics and carry out analysis, such as:

� posting statistics

� user statistics

� online traffic analysis

� posting habits analysis

Candidates should

� analyze the feasibility of implementing the proposed system

� describe and justify the underlying database design for the system

1. User statistics: They refer to the detailed information of the posting history of

users, such as the accumulated number of postings.

2. Posting statistics: They refer to the information of posting history, such as the

total number of posts for each day.

3. Online traffic: It refers to the online status of users.

4. Posting habits: They refer to some analysis about the statistics of posts of

different category, such as the hot topics of the forum.

1 Source : Hong Kong Examination and Assessment Authority

(http://www.hkeaa.edu.hk/DocLibrary/SBA/AS-CA-12ProjectList-Eng.pdf)

Page 5: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 5

Background

In my school, (YCHLPYSS), a group of students who study Computer

Application have been assigned a task to design a public discussion forum system in

which the database is used to store use information and forum posts. Students have to

make sure that the system should generate the four main criteria so as to maintain the

security and analyze the user behavior.

However, we are not going to create a real forum on the internet. The

technological knowledge and skills that we owned are insufficient for us to do that.

The requirement of the project also states that we need to design the system only.

2.1 Why do we choose to design a forum?2

Comparison with other Web applications

1. Electronic mailing listsElectronic mailing listsElectronic mailing listsElectronic mailing lists: The main difference between forums and electronic mailing

lists is that mailing lists automatically deliver new messages to the subscriber, while

forums require the reader to visit the website and check for new posts.

Therefore, forum seems to be more useruseruseruser----friendlyfriendlyfriendlyfriendly and convenientconvenientconvenientconvenient for spreading massive

information widely throughout the public.

2. NewsreaderNewsreaderNewsreaderNewsreader: The main difference between newsgroups and forums is that additional

software, a News client, is required to participate in newsgroups whereas using a forum

requires no additional software beyond the web browser.

Therefore, forum is an easy easy easy easy and faster faster faster faster way to obtain the information of the user. As almost almost almost almost

allallallall computers have been installed the web browser.

As the intended user of the discussion forum is the general public, they can be officers,

students or even housewives, etc. They can go to the forum at any time as long as they are

online. Therefore, the target group of users is the all of the people. The main concern is

whether it is convenient and efficient to access.

2 Source : Wikipedia

(http://en.wikipedia.org/wiki/Internet_forum#Comparison_with_other_Web_applications)

Page 6: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 6

3. Introduction of discussion forum

3.1 What is a discussion forum?3

An Internet forumInternet forumInternet forumInternet forum, or message boardmessage boardmessage boardmessage board, is an

online discussion site where people can hold

conversations in the form of posted messages.

They differ from chat rooms in that messages

are at least temporarily archived.

3.2 What are the benefits of forums?

Most of the public forums are free to online users and opened to all people. Indeed,

it provides a convenient way to communicate with others even though we do not

know about him/her. The exchange and sharing of ideas can spread through out the

world by the forum in a quick way.

3.3 Forum Structure4

User groups

A user of the forum can automatically be promoted to a more privileged user group

based on criteria set by the administrator.

An unregistered user of the site is commonly known as a guest or visitor. A guest can

usually view the contents of the forum or use such features as read marking, but

occasionally an administrator will disallow visitors to read their forum as an incentive to

become a registered member.

Post

A post is a user-submitted message enclosed into a block containing the user's

details and the date and time it was submitted. Members are usually allowed to edit or

delete their own posts.

3 Source : Wikipedia

(http://en.wikipedia.org/wiki/Discussion_forum#Forum_structure)

4 Source : Wikipedia

(http://en.wikipedia.org/wiki/Discussion_forum#Forum_structure)

Page 7: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 7

In order to analyze the feasibility of implementing the proposed system, describe and

justify the underlying database design for the design, a Data Base Management

System (DBMS) should be used to design the database system.

4. How can the database system help us to design a forum system?

A database management system (DBMS) stores computer programs that control the

creation, maintenance, and the use of a database. It allows us to develop databases for

various applications by database administrators.

A DBMS allows different user application programs to concurrently access the same

database. DBMS may use a variety of database models, such as the relational model

or object model, to conveniently

describe and support applications. It

typically supports query languages,

which are in fact high-level

programming languages, dedicated

database languages that considerably simplify writing database application programs.

A DBMS provides facilities for controlling data access, enforcing data integrity,

managing concurrency control, recovering the database after failures and restoring it

from backup files, as well as maintaining database security.

To sum up, database system can simply require us to ask query questions, which

facilities the efficiency of the work of designers.

Page 8: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 8

Analysis In the summer holiday, I started preparing the project. I have visited some popular

discussion forums and tried to use them. Moreover, I have observed the operation of

some forums and saw how they manage the data.

1. User statistics

Here, we usually refer to the registered users. Both of them are the examples of user

statistics.

The box shows the information of the user. This is shown whenever a user creates a

post. We can see that it shows the accumulated score and total number of posts.

Comparison between the two forums

(A)(A)(A)(A) (B) (B) (B) (B)

Forum A Forum B Showing the

exact

statistics Yes No

Other

relevant

information

Registration Date

Online status

Online status

Besides, I have found that both forums have assigned a ‘title’ under the username to

identify the users into different groups. This is also relevant to the user statistics

because the title will be assigned according to the number of post that users have

created or replied.

Page 9: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 9

2. Posting statistics

Some forums will exhibit the total number of posts. Another example is that,

Once a new post is created, it also shows that the number of users who have replied or

read the post.

A screen capture from Forum B

Forum B has shown the posting statistics on the top of the page.

A screen capture from Forum C

Forum C has shown the posting statistics on the bottom of the page. It shows the

number of posts everyday too.

3. Online traffic analysis

It is quite common to see that most forums will show the username and number of users

who are right now using the discussion forum at the bottom of the main page.

Many forums show the number of users online at the moment. Some will also show the

highest number of users visited and the date.

Forum A

Page 10: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 10

Forum B

Forum C

In addition, Forum B is quite different from the others. Besides showing the number

of users who are online at the moment, it also shows their username too. Moreover, it

classified the visitors into registered and non-registered.

4. Posting Habits

Posting habits is quite convenient to users because it sorted out the hot topics of the

discussion forum. The forum administrators can also analyze the posting habits of

users and hence decide the target group of users.

Two examples of forums

Page 11: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 11

5. Analysis of database software

Compare MySQL, Oracle and Microsoft Access

My SQL Oracle Microsoft Access

Cost Free The most

expensive one

Users need to pay

licenses but not too

expensive as school will

be offered at a discount.

Data

processing

Still capable to

manage large

amount of data.

Suitable to use in

big enterprises.

Cannot integrate data in

operation of a business.

Other

advantages

1. Comprehensive

setting for the

limits of

authority

2. More secured

database

network.

3. Can be used by

multiple people

at any time.

4. Cross platform

1. PL/SLQ

Language is

available.

2. Support sub

queries

3. Very fast

1. Easy setting

2. User-friendly

3. Suitable for

beginners

4. Integrate with other

products of

Microsoft better

5. . Easily portable as

the file can be

opened with an

Access program

installed in another

computer.

Other

Disadvantages

1.Not suitable for

professional data

mining

1. Too expensive

1. Only deploy in

Microsoft Windows

2.Not suitable for

professional data mining

Page 12: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 12

Conclusion

As a discussion forum designer of the school, I prefer the Microsoft Access.

First of all, as all of the students who study Computer Application are not

advanced users of the database system yet. Microsoft Access. The user-friendly

feature of interface of the system is more appropriate for us.

Second, as it is just a project assessment for academic purpose but not business

operation, we do not have to choose Oracle as our database system. Due to the fact

that we have limited funds, the school will not accept the adoption of Oracle.

Furthermore, since school has installed the Microsoft Access program in the

computers, there is no need to buy other software. In addition, almost all of the

students installed Microsoft Windows at home computers, cross platform is not

needed.

Last but under no circumstances least, although MySQL enables us to set the

authorized people to enter the database system, this function is rather meaningless

and useless because the aim of the project does not require us to attain such a high

security level.

To sum up, Microsoft Access is the best choice among the three software.

Page 13: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 13

Design

Developing Entity Relationship Model

Steps in Developing Data Model

1. Identification of data objects and relationships

2. Drafting the initial ERD with entities and attributes

3. Refining the ERD

4. Adding key attributes

5. Adding non-key attributes

6. Diagramming generalization hierarchies

7. Validating the model through normalization

8. Adding business and integrity rules to the model

1. Terminology and Notation of Entity Relationship Modeling

Entity

� An entity is a representation of any composite information of a real object

(e.g., A user) or an abstract object (e.g., a post)

� Entities may be related to one another, e.g., a user may read or post a new post

in the discussion forum.

Figure 1. Notation for entities

Attribute

Attributes define the properties of an entity so as to

� Name an instance of an entity

� Describe the instance

� Make reference to another instance

User

Page 14: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 14

Figure 2. Notation for attributes

Relationship

Relationships are links connecting to entities that define the relationships of the entities.

There are may be more than one relationship between two (or more) entities, e.g., user

reads posts, user creates posts in which reads and creates are relationship between the

user and the post entity sets.

The ERD notation for relationship is a diamond with the name of the relationship as the

label of the shape. The following ERD says a user would read news.

Figure 2. Notation for relationship (diamond shape connected to associated entities).

Cardinality and Existence (or Modality)

Cardinality defines the actual number of entities that must be included in a

relationship. Cardinality information can be divided into 2 types – minimum

cardinality and maximum cardinality. Data modeling concerns whether or not

the minimum cardinality is zero and whether or not the maximum cardinality is

greater than one, i.e., one (1) or many (M) , as such information will affect how a

data model is translated into a data schema, i.e., database design.

User_ID

User

Post

read

Page 15: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 15

2. Application of ERD in the discussion forum system

First and the foremost, we have to design the structure of the database system.

We can use an Entity Relationship Diagram (ERD) to illustrate the structure

clearly. The ERD is shown below:

NevronDiagram.NET2011Volume

Copyright©1998-2011NevronSoftware EvaluationMode

Page 16: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 16

In the above ERD, the relationships between entities are clearly shown.

Rectangles represent entities or we called record. Ellipses represent the

attributes or we called fields. Rhombuses represent the relationship between the

two entities. Underlined attributes imply that they are the primary keys of the

corresponding entities where they are unique and not null.

1, O, M is the cardinality and existence of a relationship. O implies that the

existence of the entity in the relationship is optional. 1 means that the existence of

the entity in a relationship must have at least one of at mist one. M represents

more than one existence between entities.

Basic Conversion Process

The three rules in the process are follows:

1. For a 1:1 cardinality relationship, all the attributes of the related entities are

grouped in to a single table.

2. For a 1:m cardinality relationship, model each of the related entities in

separable table and post the primary key of the ‘one’ side entity as an(foreign

key) attribute to the table that represents the ‘many’ side entity.

3. For an m:m cardinality relationship, model each of the related entities in a

separate table and create a new table(which is referred to as the intersection

table) and post the primary key of each entity set/type as an attribute in the new

table. If the relationship has its own attributes, those attributes are to be stored

in the intersection table too. The primary key of the intersection table is a

composite key which includes the primary key of each concerned entity type.

Page 17: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 17

3. Examples of relationships between user and news

Example one-(1:M relationship)

The relationship indicates that a user may post any number of news whereas each new

is exactly associated with one user (as each new will post by one user only).

According to the second rule of the basic conversion process, the primary key of the

User entity must be posed to the table that represents the News entity.

The resultants tables for representing the relationship will be as follows:

User(User_ID,User_Name,Sex,Dob,Online,Password,Registration_day,

Last_time_online)

News(News_ID, date_time, IP_address, Catalog, User_ID)

Example Two-(M:M relationship)

The relationship indicates that a user may read any number of news whereas news is

not necessarily read by users(some news can be read by no one). On the other hand,

news can be read by numerous users.

According to the third rule of the basic conversion process, the primary keys of both

the User and News entities must be posed to a new table, i.e., the intersection table, to

link to the tables that represent the concerned entities.

The resultants tables for representing the relationship will be as follows:

User(User_ID,User_Name,Sex,Dob,Online,Password,Registration_day,

Last_time_online)

News(News_ID, date_time, IP_address, Catalog)

Read(User_ID,News_ID,date_time)

Page 18: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 18

Example Three-(M:M relationship)

The relationship indicates that a user may reply any number of news whereas news is

not necessarily replied by users(some news can be read by no one). On the other hand,

news can be replied by users.

According to the third rule of the basic conversion process, the primary keys of both

the User and News entities must be posed to a new table, i.e., the intersection table, to

link to the tables that represent the concerned entities.

The resultants tables for representing the relationship will be as follows:

User(User_ID,User_Name,Sex,Dob,Online,Password,Registration_day,

Last_time_online)

News(News_ID, date_time, IP_address, Catalog,)

Reply(User_ID,News_ID,date_time)

Data Schema for the discussion forum system

After applying the two rules specified in the basic conversion process, we can

obtain the data schema for the discussion forum system

User(User_ID,User_Name,Sex,Dob,Online,Password,Registration_day,

Last_time_online)

News(News_ID, date_time, IP_address, Catalog, User_ID)

Read(User_ID,News_ID,date_time)

Reply(User_ID,News_ID,date_time)

Page 19: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 19

Implementation Creating Database objects

Create a database

User

There are 15 registered users in the forum. The first table User stores the information of

users, including user ID, user name, sex, date of birth, online status, password, date of

registration, time when last visited.

News

There are 13 news in the forum. The table News stores the information of news,

including news id, catalog, date of which created, the IP address and the User ID.

Page 20: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 20

Read

The table Read stores the information of users

who had read the news, including user id, news id and the date.

Reply

The table Reply stores the information of users who had replied the news.

Page 21: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 21

1. Generating User Statistics

To generate the statistics of users’ information, we can make use of different tables to

collect their information.

Example one

Input: SELECT News.User_ID, Count(*) AS Total FROM News

GROUP BY News.User_ID ORDER BY count(*);

Expected result:

To show how many news that users had posted.

Also, we want to see the most active user in the forum.

Example Two

Input : SELECT User_ID, Sex, (Date()-[dob])/365 AS AGE FROM [User]

order by (Date()-[dob])

Expected result:

To show the gender and the age of the users

Example Three

Input : SELECT year(Registration_date)AS Yr , count(*) AS Total FROM [User]

group by year(Registration_date)

Expected Result:

To show the number of users registered in the past four years.

Page 22: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 22

Example Four

Input : SELECT User.User_ID, User.User_Name, #2010/04/10#-Last_time_online AS Days

FROM [User] order by #2010/4/10#-Last_time_online;

Expected Result:

To show the accumulated no. of days that the users had not visited the

Forum since their last visit.

2. Generating Posting Statistics

Example One

Input: SELECT Count(*) AS Total FROM News;

Expected Result:

To show the total number of news posted in the forum.

Example Two

Input: SELECT Year([Date_time]) , Count(*) AS Total FROM News

GROUP BY Year([Date_time]);

Expected Result:

To find out the number of news that created over the past 4 years.

Page 23: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 23

3.Generating the Online Traffic Analysis

Example One

Input:

Select User_ID, User_Name from User where Online

Expected result:

To show who is online.

Example Two

Input: Select count(*) AS Num from User where Online

Expected Result:

To show the number of users who are now online.

Page 24: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 24

4. Generating the Posting Habits

Example One

Input: SELECT Category, count(*) AS Total

FROM News Group by Category

Expected Result:

To show the number of news in each category.

Example Two

Input: SELECT News.Category, count(*) AS Total

FROM News INNER JOIN [Read] ON News.News_ID =[Read].News_ID

Group by News.Category Order by count(*)

Expected Result:

To show the number of users who visit the news.

Page 25: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 25

Validity of Data

1. Checked automatically by the system

If a key field is not entered, the system will tell the user.

For example,

the primary key field News_ID had been seted in not null.

I forgot to enter the News_ID first, and then I enter the field category.

After that, the system will warn me that I had not entered the Key Field.

Therefore, the mistake can be corrected immediately.

Page 26: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 26

2. Checked manually

There are mistakes that the computer cannot check automatically. I have to

check by myself to see if the data is inputted illogically.

But what is meant by ‘illogical mistake’?

For example, the user A1001 had already registered on 2 Jan 2006. He cannot

post any news before the date 2 Jan 2006. If the table News had recorded his

posting history as on 1 Jan 2006, then, it is an illogical mistake that I have made.

To avoid the mistake, I have done the following set-up.

In the table News, the User_ID is the foreign key that links to the table User.

I can add a sub table under each record in the User. Then, I can see if the date

that the user had posted news is entered logically.

Page 27: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 27

Testing & Evaluation

After the database had been created, I have to perform five testing plans and

evaluate to solve some problems.

In fact, there are many changes in the database design and the data of a

discussion forum system in the reality.

In the five different situations, I will use different solutions to meet the

problems by using the SQL command.

Testing

Plan

Objective Expected

Result

1 Generating

User

Statistics

1. No. of news created by each user.

2. Gender and age of users.

3. No. of users registered.

4. No. of days where users have not visited.

2 Generating

Posting

Statistics

1. Total no. of news created.

2. No. of news created in each year.

3 Online

Traffic

Analysis

1. The users who are now online.

2. The no. of users who are now online.

4 Posting

Habits

Analysis

1. No. of news in each category.

2. No. of users who read the news.

Page 28: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 28

Generating User statistics

Example 1

Input : SELECT News.User_ID, Count(*) AS Total FROM News

GROUP BY News.User_ID ORDER BY count(*);

Actual Result:

It shows the number of news that user had posted in the forum.

We can find out the user who posted the highest number of news in the forum.

Example 2

Input : SELECT User_ID, Sex, (Date()-[dob])/365 AS AGE FROM [User]

order by (Date()-[dob])

Actual Result : It shows the age of all the users.

The forum can analyze the main group of users.

In this example, we can see that 60% of the users are below 25-year-old.

Page 29: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 29

Example 3

Input : SELECT year(Registration_date)AS Yr , count(*) AS Total FROM [User]

group by year(Registration_date)

Actual Result:

It shows the number of users who registered in different years.

Still, there is a declining number of registered users.

Example 4

Input : SELECT User.User_ID, User.User_Name, #2010/04/10#-Last_time_online AS Days

FROM [User] order by #2010/4/10#-Last_time_online;

Actual Result:

Assume that the date that the administrator checks is on 10 April 2010.

The result shows the number of days that the users have not used the forum since

the last visited date.

For example, if he found that some users had not been to the forum for over 6

months. The forum would send a mail to the user automatically.

Page 30: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 30

Generating Posting Statistics

Example 1

Input: SELECT Count(*) AS Total FROM News;

Actual Result:

It shows the total number of news in the forum.

There are total 13 news in the forum.

Example 2

Input: SELECT Year([Date_time]) , Count(*) AS Total FROM News

GROUP BY Year([Date_time]);

Actual Result:

The result shows the number of news posted in each year.

Page 31: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 31

Generating Online Traffic Analysis

Example 1

Input: Select User_ID, User_Name from User where Online

Actual Result :

The result shows the users who are now online.

Nowadays, most of the forums had added a function where users can see the

online status of the other users and they can also chat with each other.

Example 2

Input: Select count(*) AS Num from User where Online

Actual Result:

The result shows the number of users who are now online.

Usually, the number will be displayed at the bottom of the front page. Many

forums had done the statistic to calculate the highest number of people online

concurrently. This indicates a very important message to the public because it

reflects the popularity of the forum.

The more users go to the forum concurrently, the more popular the forum

would be. Furthermore, the popularity of the forum is the main factor of the

advertisers to decide to put their advertisements in the forum.

Page 32: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 32

Generating Posting Habit Analysis

Example 1

Input: SELECT Category, count(*) AS Total

FROM News Group by Category

Actual Result:

It shows the number of news in each category.

In this case, the most popular category is Sports.

Example 2

Input: SELECT News.Category, count(*) AS Total

FROM News INNER JOIN [Read] ON News.News_ID =[Read].News_ID

Group by News.Category Order by count(*)

Actual Result:

The result shows the categories of the news that how many users to read. As a

result, the administrator can know which type of news is the most popular. Then,

usually, the hot topics will be put on the upper side of the front page of the

forum.

Page 33: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 33

Conclusion and Discussion

After creating a database for the discussion forum system, I found that

database is useful for data processing. More importantly, I felt that the use

of database greatly improves the efficiency of work.

The whole implementation process

At first, I had to collect all the data of the users’ information and

the detailed information of postings. For example, the user ID,

user name, date of birth, so on and so forth. For the postings,

there are news ID and the date of posts. After that, I created

four tables to store the data by using relevant SQL command.

But how could I do all the steps successfully? This is based on

the knowledge that I have acquired in the computer lessons.

During the process of creating tables, I had to state which

attributes are the primary keys, whether the keys are unique or

not…… Relationships between tables and tables are linked by

the foreign keys. In my case, after I created the tables, I also set

the associations between the tables. Otherwise, the functions of

the database will not perform properly. For example, the User

ID attribute is the primary key of the table User, but also the

foreign key of the table News.

Next, I had to make certain SQL commands to achieve the four

purposes of the database of discussion forum system. They are

the user statistics, posting statistics, online traffic analysis and

the posting habit analysis.

Eventually, the creation of the database is still successful

because the four main purposes are satisfied.

However, there are some problems that I have met in creating

the database.

Page 34: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 34

Problems that I have met

First of all, I find that there exists a problem – how to ensure

that the data is inputted logically. I have added a sub-table

under each record in the table User. Then, it is more convenient

and faster to double check the data. But still, it is not 100%

correct. As the data is checked manually, mistakes can still be

made.

Second, in generating the user statistics, there is still some

space for improvement. For example, in User table, there is an

attribute – Online status. I have set some of the users’ status is

online. On the other hand, referring to the Read and News table,

I had made a statistic to show that the days which the users

have not been to forum. Here, I found that there exists a

problem. Those users who are online should be regarded as zero

days if the administrator is counting the days at this moment.

Thirdly, in generating posting statistics, I had not made full use

of the table Reply. Besides creating news, replying news also

creates certain number of news. A user may reply a piece of

news several times. These situations are not counted in my

study. As a result, my work is not sufficient to generate a real

world situation of the operation of a discussion forum.

Limitation of my study

Subject to the limitation of skills and knowledge, I am not

eligible to design a real webpage of a discussion forum. The part

that we focus is on the database structure of a forum and how to

generate the relevant statistics under the operation of a forum.

Page 35: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 35

In addition, to generate a statistic that showing the highest

number of online users. As the number is always changing at

different moments of time, it is possible that the number of

online users drop to zero in the next minute. Therefore, the

statistic should be set at each second of time in order to collect

the exact numbers more accurately. In my study, with limitation,

I can only reflect the situation at the moment of time.

To conclude, it is a useful tool for administrators to analyze the

data when collecting the information from the forum. Database

is more user- friendly in a way that users can input the SQL

command only to generate the statistics that they want.

However, the work cannot be done automatically, I have to apply

relevant query and input them in a correct way.

MS Access is an acceptable tool to make a simple database

system subject to the small scale of my project. Nonetheless, in a

real life situation, it is not sufficient to store all the data of a

discussion forum.

Page 36: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 36

Documentation

Hong Kong Examination and Assessment Authority

http://www.hkeaa.edu.hk/DocLibrary/SBA/AS-CA-12ProjectList-Eng.pdf

Wikipedia http://en.wikipedia.org/wiki/Discussion_forum#Forum_structure)

Discussion Forums

http://www.discuss.com.hk/

http://www.uwants.com/index.php

http://lsforum.net/board/index.php

Textbook

Database for A/AS Level by Raymond W.N. CHAN)

Page 37: Hong Kong Advanced Level Examination 2012 ASL Computer ...lawsir/ca/sba2012/7ACHU... · Analysis of database system software 11 Conclusion 12 ... Hong Kong Examination and Assessment

HKSAL 2012 Computer Application Project Assignment – Discussion Forum System 37

Working Schedule

Parts Period

Research on

discussion

forum

During the summer holidays

Presentation

of findings

On 16 September 2011

Objective

And

Analysis

From 20 September to 10 October

Design

And

Implementation

From 10 October to 5 November

Testing

And

Evaluation

From 6 November to 12 November

Conclusion

And

Discussion

By the end of 22 November