INDUSTRIAL TRAINING REPORT JUNE – JULY 1997 TOPIC : UNIVERSITY STUDENT DATABASE : AN OBJECT - ORIENTED APPROACH BY: GEORGE JOSEPH B.E. (E & C) IV YEARDEPARTMENT OF ELECTRONICS AND COMPUTER ENGINEERING UNIVERSITY OF ROORKEE ROORKEE – 247 667 U.P. (INDIA)
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
I hereby certify that the work which is presented in the industrial Training Report entitled“UNIVERSITY STUDENT DATABASE: AN OBJECT-ORIENTED APPROARCH” in
fulfillment of the requirement for the industrial Training is an authentic record of my
work carried out for a period of Six weeks, from 1/June/97 to 20/July/97, under thesupervision and guidance of Dr. R.C. Joshi, Professor, Head of Department, Electronics
and Computer Engineering and Coordinator of New Computational Facilities (NCF)
Date : …………………………………… ……………………..
George Joseph
CERTIFICATE
This is to certify that the above statement made by the candidate is correct to the
We are grateful to the Department of Electronics and Computer Engineering, for providing facilities and a environment conducive to doing our Industrial Training.
We thank the staff of University of Roorkee Computer Center for their excellent
professional work.
We would like to express our deep gratitude to Dr. R.C. Joshi, Professor, Head of
Department Electronics and Computer Engineering and Coordinator of New
Computational Facilities (NCF) whose guidance and support was of Great value in our
An up datable storage of information of an application’s world and managing soft ware,that conceals from the user the physical aspects of information storage and information
representation. The information stored in a database is accessible at a logical level
without involving the physical concepts of implementation.
Object oriented programming
Although the principles of structured programming improved the clarity, reliability, andease of maintenance of programs, large scale programming still remains a challenge.
Object-oriented programming (OOP) brings a new approach to that challenge. Unlike
procedural programming, which emphasizes algorithms, OOP emphasizes the data.
Rather that trying to fit a problem to the procedural approach of a language, OOPattempts to fit a problem. The idea is to design a data from that corresponds to the
essential features of a problem. In C++, class is a specification describing such a newdata form, and an object is a particular data structure constructed according to that plan.
For instance a class could describe the general properties of a corporation executive
(name, tile, salary, unusual abilities, etc.), while an object would represent a specific
executive. In general, a class defines what data is used to represent an object and theoperations that can be performed upon that data.
The OOP approach to program design is to firs design classes that accurately representthose this with which the program deals. The class definitions, recall, include a
description of permissible operations for each class, such as moving a circle or rotating a
line. Then you proceed to design a program using objects of those classes. The processof going from a lower level of organization, such as classes, to a higher level such as
program design, is called bottom-up programming.
There is more to OOP programming than the binding of data and methods into a class
definition. OOP, for example, facilitates creating reusable code, and that eventually can
saver a lot of work. Information hiding safeguards data from improper access.Polymorphism lets you create multiple definitions for operators and functions; with the
programming context determining which definition is used. Inheritance lets you derive
new, classes from old ones. As you can see, OOP introduces man new ideas and involvesa different approach to programming than does procedural programming. Instead of
concentrating on task, you concentrate on representing concepts. Instead of taking a top-
down programming approach, you sometimes take a bottoms-up approach.
OOP (Object Oriented Programming is a new way of organizing programs. It has
nothing to do with any programming language, although a programming language thatsupports OOP makes it easier to implement the OOP techniques. Simply stated, OOP is
an approach to software design in which the decomposition of a system is based upon the
concept of an object. An object is an entity whose behavior s characterized by the actionsthat it suffers and that it requires of other objects. Object-Oriented Development is
fundamentally different from traditional Functional (Structured) methods for which the
primary criteria for decomposition is that each module in the system represents a major
step in the overall process.
OOP is a method of designing and implement software. The use of OOP in itself does
not impart anything to a finished software product that the user can see. However, the
software developer may gain some advantages by using OOP methods, especially in largeSoftware projects. Because OOP allows one to remain close to the conceptual, higher
level model of the real-world problems one is trying to solve, one can manage thecomplexity better with it, than with approaches that force one to map the problem to fit
the features of the language. On can take advantage of modularity of objects and
implement the program in relatively independent units that are separately maintainable.
On can also share code and data among objects through inheritance.
FEATURES OF OBJECT – ORIENTED LANGUAGE.
A few if the major elements of object-oriented languages in general and C++ in particular
are examined below:
Objects
When one approaches a programming problem in an object-oriented language,one no longer asks how the problem will be divided into functions, but how will
be divided into object. Thinking in terms of objects, rather than functions, has a
surprisingly helpful effect on how easily programs can be designed. This results
from the close match between objects in the programming sense and objects in thereal world.
“What kind of things become objects in object-oriented programs?” The answer to this is limited only by ones imagination, but some typical categories are given
A table of the latitudes and longitudes of would cities
User – defined data types
Time
Angles
Complex numbersPoint on the plane
Components in computer games
Ghosts in a maze game
Positions in a board game (chess, checkers)Animals in an ecological simulation
Opponents and friends in adventure games (Prince)
The match between programming objects and real-world objects is the happy result of combining data and functions: The resulting objects offer a revolution in program
designs. No such close match between programming constructs and the items being
modeled exists in a procedural language.
Class
A class is specified as a means of grouping all the object which share the same of
attributes (data member functions (Methods). An object must belong to only one class as
an instance of that class. The relationship between an object and its class is the familiar
instance-of relationship. A class is similar to an abstract data type. A class may also be
The primary goal of object-oriented analysis is the development of an accurate and
compete representation of the problem domain. The Coad and Yourdon object-oriented
analysis method is discussed in the following section.
Coad and Yourdon Object-oriented analysis
Coad and Yourdon view their OOA methodology as building “upon the best concepts
from information modeling, object-oriented programming languages and knowledge-
based system”. OOA results in a five-layer model of the problem domain, where eachlayer builds on the previous layers. The layered model is constructed using a five-step
procedure:
1. Define object and class
Look for structures, other systems, devices, events, roles operational proceduressits, and organizational units.
2. Define Structures
Look for relationship between classes and represent them as either general-to-
specific structures or whole-to-part structures.
3. Define subject areas
Examine top-level objects within whole-to-part hierarchies and mark these ascandidate subject areas. Refine subject areas to minimize interdependencies
between subject.
4. Define attributes
Identify the atomic characteristics of objects as attributes of the object. Also look
for associative relationship between objects and determine the cardinality of thoserelationships.
5. Define services
For each class and object, identify all the services it performs, either on its own
behalf or for the benefit or other classes and objects.
A complex diagram consisting of five layers, each adding a level of detail. The layers are
(1) Class and object layer, which connects and objects enclosed within boxes with
rounded corners.
(2) Structures layer, which connects classes and objects with arcs to show
generalization-specification and whole-part inheritance relationships.
(3) Subjects layer, which adds border around closely related classes.
(4) Attributes layer, which adds a list of attributes inside the class and object boxes and identifies associative relationships between objects.
(5) Service layer, which adds a list of services inside the calls and object boxes
and provides arcs showing message connections between boxes.
Object-state diagram:
A simple diagram that shows all the possible states of an object and the allowed
transitions between states. States are enclosed within boxes and transitions are
represented as directed, unlabeled arcs between states.
Service chart
A flowchart-like diagram that depicts the detailed logic within a individual service,
including object-state changes that trigger or result from the service.
Coad and Yourdon explicitly support each of the essential principles of object
orientation. The class and objects diagram (levels 1,2 and 4) provides and object
classification and identifies potential inheritance relationships. In addition, encapsulationof object is modeled trough the concept of exclusive services.
OBJECT-ORIENTED DESIGN (OOD)
Design is a process of mapping system requirements defined during analysis to an
abstract representation of a specific system-based implementation, meeting cost and
performance constraints. Now the Booch object object-oriented design method isdiscussed.
Booch object-oriented design
Booch views his methodology as an alternative to, rather that an extension of, structured
design. Booch describes a host of techniques and tools to assist design, raning from
It shows the existence of classes (enclosed in dotted-line “clouds”) and their relationships(depicted by various kinds of directed and undirected) in the logical design of a system.
Relationships supported included uses, instances, inherits, metaclass and undefined.
Object diagram/template
It is used to model some of dynamics of objects. Each object (enclosed in solid line“clouds”) represents an arbitrary instance of a class. Objects are connected by directed
arcs that define object visibility and message connections. It does not show flow of
control or ordering of events.
Operation template
It is structured text that provides detailed design documentation for operations.
Process diagram/template
It is used to show the allocation of processes to processors in the physical design of a
system. It is required only for implementations in multiprocessor environments.
State transition diagram
It shows the states (depicted by circles) of a class, the events (directed arcs) that cause
transitions from one state to another, and the actions that result from a state change.
Timing diagram
It is a companion diagram to the object diagram, showing the flow of control and
ordering of events among a group of collaborating objects.
Booch OOD provides the widest variety of modeling tools of the OOD methodologies. It
provides a wealth of guidance on the design process by describing in detail the types of
activities that must be performed.
3: DATA MANAGEMENT
A data base is, fundamentally, body of information contained in a mechanism that
facilities the use of the information. A data base must be distinguished from the many
mechanisms available for managing records the envelopes in which information iscarried.
Why should we choose to store our operational data in an integrated database?
Lets us consider some of the advantages that accrue from having centralized control of
the data, as discussed above:
Redundancy can be reduced
In no database systems each application has its own private files. This can often lead toconsiderable redundancy in stored data, with resultant waste in storage space.
Inconsistency can be avoided (to some extent)
This is really a corollary of the previous point.
The data can be shared
It means that, not only that existing applications can share the data in the database, but
also that new applications can be developed to operate against that same stored data. In
other words, the data requirements of new applications may be satisfied without having tocreate any new stored files.
Standards can be enforced
With central control of the database, the DBA (Database admistrator) can ensure that all
allocable standards are followed in the representation of the data.
Security restrictions can be applied
Having complete jurisdiction over the operational data, the DBA
(a) Can ensure that the only means of access to the database is through the proper channels
(b) Can define authorization checks to be carried out whenever access to sensitivedata is attempted.
Integrity can be maintained
The problem of integrity is the problem of ensuring that the data in the database is
accurate.
Generally the DBMSs have a three level architecture which is in agreement with the
proposals made by the ANSI/SPARC Shidy Group on DBMSs(2). The advantage of thethree level architecture is that it simplifies the design and management of the r database
system by providing a higher level of program/data independence.
The technique used to represent and to store records on a file is referred to as file
organization. The three fundamental organization techniques that we will discuss in thecoming chapters are:
1. Sequential2. Index sequential
3. Direct access (Relative)
It is the file organization that determiners files record ordering i.e., physical ordering of records in storage. Also the file organization determiners the set of operations necessary
to find particular records (i.e., Access method is the way the records is accessed (read)
from a file.
File organization represents the arrangement of the records within a file whereas Data
organization represents arrangement of data within a record.
Sequential file
The most basic way to organize records in a fie is to use sequential organization in thisorganization, records are written consecutively when either a file is created or a record in
inserted in it. At the time of accessing the records are accessed in the same order as they
were inserted (serial access) i.e. accessing follows FIFO (First out) technique. For instance if a stores 800 records and a record number 730 is to be accessed then first 729
records must be read one by one in order to read 730th record.
The records of a sequential file are ordered by the value of some field in each record.
Such a file is called sorted file and field (s) which determiners the order of records n
know as sort key.A file may be sorted in ascending or descending order by the value of a sort key which
might be composed of one or more fields. For example a file employee file (empno,
empname, desig, dept, basic pay grade) may be sorted on empno, then empno becomes its
sort key.
A file, in which records are accessed in the same order as they were written in but there is
no importance in the key field i.e. file is not arranged in a particular is called serial fileand organization is referred to as serial organization.
Storage media for sequential file
For storing the sequential file the storing medium should be such that it can support the
very nature of the sequential files i.e., it should be able to provide the serial access.
Sequential organization suits electromagnetic devices like tapes, which are sequential by
nature or disk devices which are capable of sequential operation.
In practice, sequential files are by nature or for application which need to access its
records serially e.g. in an organization to prepare the pay slips of all its employees, itneeds to access all records if employee file one by one (serially) in order to get data for
pay slips.
File operations on a sequential files
Before any file operation is performed in a sequential file the, its processing determine
the appropriate order for sorting the records of a sequential file e.g. to generate pages’ of
a telephone directory, the information should be ordered by the subscriber’s last name
and first name. Therefore before performing any operation on a file its processingrequirements must be determined.
CREATION of a sequential file
The creation of a sequential file involves the creation of records in the required order (sequence) into an appropriate storage medium (which support sequential organization).
The creation of sequential file involved tasks of
i) Collecting data
ii) Converting data into machine readable form
iii) Validating (to avoid incorrect data) the datra,iv) Correcting rejected data
v) Sorting (arranging data in a particular order) data.
Step (iii) and (iv) are very important steps as these to ensure the correctness of the input
data. Validation involves the verification procedure to check that the data values being
entered are actually the same as that of original values and no data values are missed.
Validation might include following types of checks:
(a) Data value must be within a proper range e.g. in a date
(dd/mm/yy) dd must be within 1-31; mm must fall within 1-12,etc.; similary; sex must be either M or F.
(b) Presence of required fields, e.g., empno must be present for an
employee record.(c) Proper types of values e.g., a numeric field cannot contain
alphabets.
(d) Check sums e.g., total number of input record must be equal to
Updation may involve insertion, modification deletion of record (s) of a file. A master file is updated time to time in order to reflect the latest status. A master file represents a
static view of some aspect of a organizations business. However most aspects of an
organization's business keep on changing; for instance, employee status changes whenemployees are hired or fired; products status changes when prices are revised or quantity-
on-hand changes. These changes must be incorpated into master file in order to make it
reflect accurately the state of an organization.
A Master file can either be updated interactively i.e. as soon as need arises for master file
updation, it is updated there and then, or in batch updation manner in which transaction
(change which are going to be applied to master file) are collected and are periodicallyapplied, to update master file.
Frequency of master file updates
The frequency at which master file should be updated depends upon several factors like:
(i) Rate of change of data. More frequently the data changes (i.e. transactions
occur), more frequently the master file will be updated.
(ii) Size of master file. Larger is the size of master file less frequently it will be
updated, as with
(iii) Urgency of need for current data on master file. More frequently is the
current data is required, more frequently master file will be updated.
(iv) File activity ratio.
A file activity ratio, may be defined as follows:File activity ratio = Number of records read and used (No of transactions)
Number of records in master file
More is the file activity ratio more frequently the master file will be updated. If the fileactivity ratio is less (say 20%), then master file will be updated after a gap of time (during
which the transaction occur), as the greater the length of time between master file
updates, the greater will be the file activity ratio.
STEPS IN BATCH UPDATION
In batch updation, transactions are collected in form of a file and master file us
periodically updated using this transaction file by processing all transaction one by one.
If master file uses sequential organization, the transaction data should also be sorted in
the same order before processing. There can be three update operations viz insertion,
modification or deletion which are performed by checking transaction type field's value.
Update Logic
Since both the files the master file, the transaction file in the same order, all the operation
are performed by matching primary key's values of both files records. The update logic
is given below. One record is read from both the files their keys are matched and in caseof the matching keys, corresponding operations are (insertion,/modification/deletion) is
performed by checking the transaction record type.
While updating there could be two cases possible (i) a record in the master file has onecorresponding transaction record with the matching key value, and (ii) a record in the
master file has more than one transaction records with matching keys. The logic being
given below handles both mentioned cases. Every time after batch updation, new master
file is crated after incorporating the changes in the old master file. The record to beinserted is written directly in the into the master file. The record to be modified is first
searched for in the old master, if found changes are incorporated in it and then written into the new master file. The record to be deleted is first searched for in the old master file,
if found is not copied on to the new master. The records of the old master, which do not
have any corresponding transaction are copied as they are, on to new master.
Batch updation algolithim
Create (NEWMASTER) /*allocate space for new file
Open (OLDMASTER, TRANSACTION, NEWMASTER)Read (TRANSACTION, TRANSREC)
Read (OLDMASTER, OLDMAS-REC)
While not cof (TRANSACTION) and not cof (OLDMASTER) doBEGIN
Another function univermenu() will be called to enable the user to go in the right
direction within the university.
These are the instruction :WELCOME TI THE UNIVERSITY MENU.
ADMISTRATION.
DEPARTMENT.STUDENT ORGANISATION
ENTER YOUR CHOICE:
This will enable the user to go the direction he/she desires in the university level.Another functions called will enable the user/search in administration, department student
organization and other sections in the university. Other functions are datamenu(),
editmenu(), esmenu()
DB.H
This sub-program just defines constants which will be used in the main program. These
are FNAME_SIZE,NAME_SIZE.
STRY.CPP,TRY.CPP AND SUB.CPP
All these sub-programs do the same job in the main program of Adding data in the file,
Deleting data from the file, Modifying data in the program, Searching the required datafrom the program. In the respective sub-programs there classes which are used to enable
the main program to do all the editing like adding to file, deleting from file, modifying
data in the file searching any data in the file etc..
FILES
Files which are dealt with are STUDENTS files of different departments and different
classes, FACULTY_MEMBERS files of different departments, ADMINISTRATION
files, STUDENT_ORGANISATION files and UNIVERSITY files which are calledrespectively with the execution of the program.
TOOLS USED
The language used in designing this program is TURBO++ which is rather flexible and
useful in different applications. T is powerful modern language that combines the power,elegance and flexibility of C and the features of objected-oriented programming. With its
object-oriented capabilities such as data abstaction, inheritence and polymorphism, C++
offers significant software engineering benefits over C.Programming pandits expect thatC++ will replace C as a general-purpose programming language. C++ is the language of
Object oriented systems are useful in modeling many real world situations in which real
objects can be put in one to one correspondence with program classes and objects.
In object – orented systems there is a simplicity in structure because almost every thing is
an object. In the object paradigm, systems become individual, self -. Contained units thatexhibit a certain behaviour of their own and interact with other objects only through the
passing of messages (calling members functions). Tasks get performed when a message
is sent to an object that can perform the task. Al the details of the task are rightfully