You are on page 1of 7

CHAPTER 3

SYSTEM DESIGN

The System Design Document describes the system requirements, operating environment,
system and subsystem architecture, files and database design, input formats, output layouts,
human-machine interfaces, detailed design, processing logic, and external interfaces.
Systems design is the process of defining the architecture, modules, interfaces, and data for a
system to satisfy specified requirements. Systems design could be seen as the application of
systems theory to product development.

3.1 Design of fields and records

The key is declared as a character array that can hold a maximum of 5 characters. Checks are
done to ensure the key if of exactly 3 characters during input and have only digits. The other
fields are also character array. All of the fields are character array that can hold a string value
of some maximum size. Hence we fix the fields into a predictable length and place a
delimiter at the end of each field to separate it from the next field.

The size of the array is larger than the longest string it can hold. Hence, we preserve the
identity of fields by separating them with delimiters. We have chosen the vertical bar
character commonly known as the pipe symbol (|), as the delimiter here. Hence we fix the
fields into a predictable length and place a delimiter at the end of each field to separate it
from the next field.

The records are used as containers to hold a mix of fixed and variable-length fields
within a fixed length record. A fixed-length record is one in which every field has a fixed
length. Each record is of 100 bytes.

All the records are stored in a bucket. Bucket − A hash file stores data in bucket
format. Bucket is considered a unit of storage. A bucket typically stores one complete disk
block, which in turn can store one or more records Each bucket can store a maximum of 5
fixed length record. There are 5 buckets used in the application. Therefore, each bucket has a
maximum size of 300 bytes and a total of 25 records can be stored.

DEPT OF ISE, RNSIT, BENGALURU 2018-2019 Page 16


15ISL68: FS Mini Project Report Event Management System

Hence we use fixed length bucket, fixed length record with variable length fields and two
pipe symbols (||) used to separate the records within each bucket and new line character (\n)
to separate the buckets in a file. The class declaration of a typical event file record and
student file records are as shown in Fig 3.1 and Fig 3.2.

Fig 3.1 class event

Fig 3.2 class student

DEPT OF ISE, RNSIT, BENGALURU 2018-2019 Page 17


15ISL68: FS Mini Project Report Event Management System

3.2 User Interface:


The User Interface or UI refers to the interface between the application and the user. Here,
the UI is menu-driven, that is, a list of options (menu) is displayed to the user and the user is
prompted to enter an integer corresponding to the choice that represents the desired operation
to be performed. If a wrong integer is entered, then the same UI is retained.
1. ADD EVENTS-used to read the Event’s details.
2. DISPLAY-displays the record from the event file as well as it also has the option to
display record form student file.
3. SEARCH-retrieves the record from the event file and student file as specified by the user.
4. DELETE- deletes the record from the event file as specified by the user.
5. MODIFY- modifies the record from the event file as specified by the user.
6. REGISTRATION-used to register the participants.
7. EXIT-used to exit the application.

Fig 3.3 User Menu Screen

3.2.1 Insertion of a Record


If the operation desired is Insertion that is to the read the data, the user is required to enter 1
as his/her choice, from the menu displayed, after which a new screen is displayed. Next, the
user is prompted to enter the Event_id followed by the other details. The user is prompted for
each input until the values for the field has been read. This means that, the user is prompted
for:

DEPT OF ISE, RNSIT, BENGALURU 2018-2019 Page 18


15ISL68: FS Mini Project Report Event Management System

 The Event_id, until the user enters one of exactly 3 characters each of which is a
digit, else it displays invalid number message and user is prompted to read Event_id
again.
After all the values are accepted, hash () is called that is used to generate the address of the
bucket where the record has to be stored and finally store () is used to store the record in the
data file and the user can press any key to return back to the menu screen.

3.2.2 Display of a Record


If the operation desired is to display the records, the user is required to enter 2 as his/her
choice, from the menu displayed, after which a new screen is displayed. If there are no
records in the data file, then no record is displayed. If the data files have at least 1 record, the
details of each record within the file, with suitable headings, is displayed in a row and
column format is displayed. The first row contains the heading and then is followed by the
record details of each record. In each case, the user is then prompted to press any key to
return back to the menu screen.

3.2.3 Search of a Record


If the operation desired is Search, the user is required to enter 3 as his/her choice, from the
menu displayed, after which a new screen is displayed. Next, the user is prompted to enter
the Event_id (key) that has to be searched. If the record is not found in the data file, a
“RECORD DOES NOT EXISTS” message is displayed, and the user is prompted to press
any key to return back to the menu screen. If the matching key is found using the retrieve(),
whose matching record is to be retrieved. A “RECORD FOUND” message is displayed with
details of the record that was to be searched. In each case, the user is then prompted to press
any key to return back to the menu screen.

3.2.4 Deletion of a Record


If the operation desired is Deletion, the user is required to enter 4 as his/her choice, from the
menu displayed, after which a new screen is displayed. Next, the user is prompted to enter
the Event_id(key) that has to be deleted. If the record is not found in the file in the file, a
“RECORD DOES NOT EXISTS” message is displayed, and the user is prompted to press
any key to return back to the menu screen. If the matching key is found using the retrieve(),

DEPT OF ISE, RNSIT, BENGALURU 2018-2019 Page 19


15ISL68: FS Mini Project Report Event Management System

whose matching record is to be deleted. A “RECORD FOUND” message is displayed with


details of the record that is deleted. After the record is deleted the location where the record
was stored is overwritten with’#’ symbol. In each case, the user is then prompted to press any
key to return back to the menu screen.

3.2.5 Modify of a Record


If the operation desired is to Modify, the user is required to enter 5 as his/her choice, from the
menu displayed, after which a new screen is displayed. Next, the user is prompted to enter
the order number that has to be modified. If the record is not found in the file in the file, a
“RECORD DOES NOT EXISTS” message is displayed, and the user is prompted to press
any key to return back to the menu screen. If the matching Event_id(key) is found using the
retrieve(), whose matching record is to be deleted. A “RECORD FOUND” message is
displayed with details of the record that is to be modified. After the record found is deleted
and the location where the record was stored is overwritten with’#’ symbol. Next, the user is
prompted to enter the key, followed by the other details. The user is prompted for each input
until the values for the field has been read.

After all the values are accepted, hash () is called that is used to generate the address of the
bucket where the record has to be stored and finally store () is used to store the record in the
data file and the user can press any key to return back to the menu screen.

3.2.6 Design of Index


Hashing is used in this project for random access of the data. It is the transformation of a
string of characters into a usually shorter fixed-length value or key that represents the
original string. Hashing is used to index and retrieve items in a database because it is faster to
find the item using the shorter hashed key than to find it using the original value. It is also
used in many encryption algorithms.

There are 2 types of hashing static hashing and dynamic hashing. In this project static
hashing has been implemented. In static hashing, when a search-key value is provided, the
hash function always computes the same address. For example, if mod-11 hash function is
used, then it shall generate only 11 values. The output address shall always be same for that
function. The number of buckets for the program remains unchanged at all the times.

DEPT OF ISE, RNSIT, BENGALURU 2018-2019 Page 20


15ISL68: FS Mini Project Report Event Management System

Bucket − A hash file stores data in bucket format. Bucket is considered a unit of
storage. A bucket typically stores one complete disk block, which in turn can store one or
more records. Each bucket can store a maximum of 5 fixed length record each of hundred
bytes in this project. There are 5 buckets used in this application. Therefore each bucket has a
maximum size of 500 bytes and a total of 25 records can be stored. And delimiter character
“||” is used to separate the record in a file. An array is used to keep a count of records within
a bucket. Initially the file is created and is filled with ‘#’ and the count value of each bucket
is initialized to 0, and whenever a record is added to or deleted from a bucket the count is
changed accordingly. This count helps in easy retrieval of record, and performs other
operations with ease.

The hashing algorithm is called the hash function, probably the term is derived from
the idea that the resulting hash value can be thought of as a mixed up version of the
represented value. The hash function is used to index the original value or key and then used
later each time the data associated with the value or key is to be retrieved.

Thus, hashing is always a one-way operation. Ideal hash function can’t be derived by
any analysis. A good hash function also should not produce the same hash value for two
different inputs. If it does, this is known as collision. A hash function that offers an
extremely low risk of collision may be considered acceptable.

The hash function that has been used in this project is Division – remainder method. The
division method is generally a reasonable strategy, unless the key happens to have some
undesirable properties. The size of the number of items in the table is estimated. That number
is then used as a divisor into each original value or key to extract a quotient and a remainder.
The remainder is the hashed value.

Since this method is liable to produce a number of collisions, any search mechanism
would have to be able to recognize a collision and offer an alternate search mechanism. The
number of buckets considered in this project is 5 hence the divisor is 5. The sum of the
individual elements of the key (Event_id) which is a string is considered as the dividend and
it is divided with the number of buckets (5) as the divisor. The remainder is the hashed value.
Once a valid value is read we pack the data using ‘|’ as the delimiter.

DEPT OF ISE, RNSIT, BENGALURU 2018-2019 Page 21


15ISL68: FS Mini Project Report Event Management System

Collision occurs when the bucket corresponding to the computed hash value has all
the 5 records filled in it (because the bucket size considered is 5). The technique used to
resolve collision is linear probing. It was invented in 1954 by Gene Amdahl, Elaine M.
McGraw, and Arthur Samuel and first analyzed in 1963 by Knuth. Along with quadratic
probing and double hashing, linear probing is a form of open addressing. In these schemes,
each cell of a hash table stores a single key–value pair.

If faced with a collision situation, the linear probing technique will look onto
subsequent hash elements until the first free space is found. This traversal is known as
probing the table; and as it goes by one element at a time, it is linear probing. Once the end

of hash table is reached which is end of 4th bucket because the total number of buckets
considered is 5, wrap around concept is used to further check for free space from the
beginning of the table till the first computed hashed value. This traversal is known as probing
the table; and as it goes by one element at a time, it is linear probing. Once the end of hash
table is reached, wrap around concept is used to further check for free space from the
beginning of the table till the first computed hashed value.

DEPT OF ISE, RNSIT, BENGALURU 2018-2019 Page 22

You might also like