Module
Module
Rajaraman
System Analysis and Design/ Object Oriented System Modeling Learning Objectives
Learning Objectives
Motivation
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 1 1
Desirable Properties
Of Components (Contd)
Components must be general enough to be reusable
Variety of components should be reduced-this is facilitated by
allowing components to inherit properties of other components
Another aid to genaralize the function of a component is to
allow generic commands which make components do their task
This is called POLYMORPHISM
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 2 2
Object Oriented Modeling
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 3 3
Object And Their Properties
All tangible entities in an application can normally be modelled as
objects
For example: A student,a cycle,a train ticket
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 4 4
Characteristics Of Objects
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 5 5
Characteristics Of Objects
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 6 6
Class Diagram UML Notation
Universal Modeling Language (UML) is an industry standard
notation to represent a class
Example of UML notation for a Class
Vendor CLASS NAME
Vendor id
Name
LIST OF ATTRIBUTES
Address
Vendor type
Add vendor
Delete vendor OPERATIONS OR (METHODS)
Find address
Change address
Find vendor type
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 7 7
Instance Diagram
UML Notation
Shows an object instance's attributes and values
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 8 8
Operation Types On Objects
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 1 9
Operation Types On Objects
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 10 10
Implementation Of Classes
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 11 11
Implementation
Of Classes (Contd.)
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 1 12
View Of Objects
As Contractors
1) Objects can be thought of contractors who carry out assigned
contracts for clients
2) Clients need not know how the contractor carries out its
contracts
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 1 13
Inheritance
New classes are created from current classes by using the idea of
inheritance
New classes inherit attributes and/or operations of existing
classes
Inheritance allows both generalisation and specialisation in
modeling
Specialisation - given student class, arts students and science
student are two subclasses
-Subclasses inherit properties of parents and in addition may
have their own special attributes and operations
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 14 14
Example Of Inheritance
Class name College student
Roll no
Attributes Name
Address
Year of study
Operations Admit
Promote
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 16 16
Polymorphism
V. Rajaraman
V.Rajaraman SAD/M9/LU1/V1/2004
M9/LU1/V1/2004 17 17
Identifying Objects
Simple method
objects
operations
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 1 1
Criteria For Picking Objects
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 2 2
Criteria For Picking Objects
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 1 3
How To Select Objects
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 4 4
Example 1 Word Statement
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 5 5
Example 1 Word Statement
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 6 6
Example 1
Identification Of Objects
POTENTIAL OBJECTS
1. APPLICANT
2. APPLICATION
3. REGISTRARS OFFICE CLERK
4. DEPARTEMENTAL (COMMITTEE)
How to select relevant objects?
Decision based on answers to following questions
Does it have attributes?
Are operations performed on the attributes?
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 7 7
Example 1
Identification Of Objects
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 1 8
Example 1
Identification Of Objects (Contd.)
Registrars office clerk has attributes, performs operations on
application, attributes and not on clerks attributes. Thus
reject.
4. Department taken as potential object. It has attributes.
Operations are performed using attributes. Operations are
performed using attributes of application object and also
using attributes of department. Thus admit department as
an object
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 1 9
Attributes And Operations
Performed By Identified Objects
CLASS NAME
APPLICATION
ATTRIBUTES
APPLICATION NUMBER
APPLICANT NAME
APPLICANT ADDRESS
MARKS SHEET
FEE PAID RECEIPT
DEPT. APPLIED CODE
APPLN STATUS
CLERK CODE
OPERATIONS
SCRUTINIZE
SEND APPLICATION TO DEPT
SEND RESPONSE
ADMIT/W.L/REJECT TO APPLICANT
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 10 10
CLASS NAME
DEPARTMENT
ATTRIBUTES
DEPARTMENT CODE
DEPARTMENT NAME
COURSE
NO OF STUDENTS TO BE ADMITTED
NO ON WAIT LIST
MIN. ENTRY QUALIFICATION
STATUS OF APPLICATION
OPERATIONS
SCRUTINIZE APPLICATION
SEND APPLICATION STATUS
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 1 11
Example 2 : Receiving
Items Ordered
ABSTRACT OF WORD STATEMENTS
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 14 14
OBJECTS NOT RELEVANT TO THIS APPLICATION
Items
Orders
As no operations on these
Inventory
Goods taken in stock
Payment voucher
RELEVANT OBJECTS
Receiving office Even though its own attributes are not
relevant,its functional attributes are important.These are:
-Delivery note and order to vendor
It thus derives its attributes from these
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 15 15
Relevant Objects
VENDORS
No operations on this object are needed in this
application.However its attributes are necessary as the Accounts
office makes payment to vendors
CLASS : VENDORS
ATTRIBUTES :
Vendor code
Vendor name
Vendor address
VENDOR is actually an external object.We have thus given only
attributes relevant to this application.In general design one would
usually define this object more comprehensively
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 16 16
Attributes Of Delivery
Note And Order To Vendor
CLASS : ORDER TO VENDOR
CLASS : DELIVERY NOTE
Attributes :
Attributes : Order no
Receiving clerk id Vendor code
Order no Item code
Vendor code Item name
Delivery date Qty ordered
Item code Units
Qty supplied Price/Unit
Units Order date
Delivery period
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 17 17
Receiving Office Object
CLASS
RECEIVING OFFICE
Is Part of Is Part of
DELIVERY ORDER TO
NOTE VENDOR
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 18 18
Receiving Office Object
Operations :
Compare order no,item code, qty,etc in delivery note
with that in order to vendor
Send discrepancy note (if any) to purchase office and
vendor. If no discrepancy send delivery note to
purchase
Send delivery note to inspection office(object)
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 18 19
Other Relevant Objects
Operations :
Update inventory by adding no of items accepted to
qty in stock
Send advice to accounts object to make payment
for qty accepted
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 20 20
Next Object Is
Inspection Office
Operations :
Send information an accepted items to store
and accounts
Send discrepancy note( if any) to purchase
office and vendor
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 21 21
Other Objects Are
V. Rajaraman
V.Rajaraman SAD/M9/LU2/V1/2004
M9/LU2/V1/2004 22 22
Object Oriented
Modelling-crc Method
V. Rajaraman SAD/M9/LU3/V1/2004 1
Object Oriented
Modelling-crc Method (Contd.)
V. Rajaraman SAD/M9/LU3/V1/2004 2
Crc Team Idea
V. Rajaraman SAD/M9/LU3/V1/2004 3
Crc Methodology
1. Make CRC Card for each class
CRC CARD
CLASS NAME :
SUPER CLASSES AND SUBCLASSES :
SHORT DESCRIPTION OF CLASS :
COLLABORATORS :
PRIVATE RESPONSIBILITIES OF CLASS :
CONTARCTS WITH COLLABORATORS :
V. Rajaraman SAD/M9/LU3/V1/2004 4
Crc Model - Example
For Example1 of last learning unit the CRC model is given below
Class : APPLICATION
Collaborators : DEPARTMENT
V. Rajaraman SAD/M9/LU3/V1/2004 5
Crc Model - Example
Private Responsibilities :
Scrutinize : Applications are scrutinized to see if fee
is paid and marks sheet is enclosed. If yes,
applications is sent to department class.Else a
rejected letter is sent to the applicant
Contract(s) and Collaborator(s):
Forward application to department : When it
passes scrutiny else send reject to applicant
Send letter to applicant : When Department notifies
decision (Admit,Reject,Waitlist) send appropriate
letter to the applicant
V. Rajaraman SAD/M9/LU3/V1/2004 6
Crc Model Example (Contd)
Class : DEPARTMENT
Collaborators : APPLICATION
V. Rajaraman SAD/M9/LU3/V1/2004 7
Crc Model Example (Contd)
Private Responsibilities :
Rank order applications based on selection
criteria.Mark in application:admitted,rejected or in
waiting list depending o available seats
V. Rajaraman SAD/M9/LU3/V1/2004 8
Collaboration Graph
Examine application
CLASS CLASS
Admit/reject/ APPLICATION DEPARTMENT
Application status
wait list
Applicant
V. Rajaraman SAD/M9/LU3/V1/2004 9
Collaboration Graph For Example2
Delivery CLASS CLASS
Inspect
RECEIVING OFFICE INSPECTION OFFICE
Vendor Payment Update
Delivery copy Inventory
Discrepancy note
V. Rajaraman SAD/M9/LU3/V1/2004 10
System Analysis and Design Prof. V.Rajaraman
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
(i)tangible entities
(ii)intangible entities
(iii)transient entities
(iv) uniquely identifiable
a. i, ii
b. i, ii, iii
c. i, ii, iii, iv
d. i, ii, iv
9.9 A class is
a. a group of objects
b. template for objects of a particular type
c. a class of objects
d. a classification of objects
9.10 All objects have
(i)
attributes
(ii) states
(iii)a set of operations
(iv) a unique identity
a. i, ii, iii
b. ii, iii, iv
c. i, iii, iv
d. i, ii, iii, iv
9.11 In UML diagram of a class
a. state of object cannot be represented
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
b. state is irrelevant
c. state is represented as an attribute
d. state is represented as a result of an operation
9.12 Attributes are assigned value
a. when operations are performed on an object
b. when instances of objects are defined
c. when methods are invoked
d. when classes are identified
9.13 The following are intangible entities which can be defined as objects
(i) a motor car
(ii) a bank account
(iii) an aircraft
(iv) a linked list
a. i, ii
b. ii, iv
c. iii, iv
d. ii, iii, iv
9.14 A query operation on a object
a. has side effect
b. has no side effects
c. changes the state of an object
d. is not allowed
9.15 An instance of an object is created by a
a. query operation
b. update operation
c. constructor operation
d. open operation
9.16 An update operation in an object instance
a. updates the class
b. has no side effects
c. deletes an instance
d. alters values of attribute(s) of an object instance
9.17 In object-oriented design
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
a. generalize classes
b. specialize classes
c. generalize and specialize classes
d. create new classes
9.24 When a subclass is created using inheritance the resulting class
a. may have only attributes of parent class
b. may have only operations of parent class
c. may have new operations only in addition to those in parent class
d. may have new attributes and new operations in addition to those of the
parent class
9.25 By polymorphism in object-oriented modelling we mean
a. the ability to manipulate objects of different distinct classes
b. the ability to manipulate objects of different distinct classes knowing only
their common properties
c. use of polymorphic operations
d. use of similar operations to do similar things
9.26 A polymorphic operation
a. has same name
b. has same name but uses different methods depending on class
c. uses different methods to perform on the same class
d. uses polymorphic method
9.27 Given a word statement of a problem potential objects are identified by
selecting
a. verb phrases in the statement
b. noun phrases in the statement
c. adjectives in the statement
d. adverbs in the statement
9.28 Given a word statement of problem potential operations appropriate for
objects are identified by selecting
a. verb phrases in the statement
b. noun phrases in the statement
c. adjectives in the statement
d. adverbs in the statement
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
SUMMARY of Module 9
1. Complex systems are designed by breaking down such systems into a number of
3. The main motivation for using object oriented modelling is the realisation that
individual objects may be modified without affecting the other parts of the
system.
the life time scale of an application. All objects have attributes and state. A set of
operations are defined for each object which determines their behaviour.
specified operations.
7. Objects having similar meaning and purpose may be grouped together to form a
10. A class A may have attributes and operations which are identical to another class
B in addition to its own attributes and operations. In such a case class A is said to
inherit some of the properties of their parents in addition to their own properties
14. From among potential objects the relevant ones appropriate for modelling are the
ones which have specific responsibilities and essential for the functioning of the
system.
15. Having identified objects and their responsibilities the next step is to find the
16. A document is prepared for each class giving its own responsibilities, its
17. A graph showing pictorially the classes and their mutual collaboration completes
System Analysis and Design /Object Oriented System Modeling Worked Out Problems
Worked Examples
9.1 What is object-oriented modelling?
Object-oriented modelling is a methodology of analyzing requirements of a system
with the aim of identifying subsystems with the following desirable properties:
(a) Each subsystem should have clearly specified responsibility of performing a part
of overall task.
(b) Other parts of the subsystem should not have to know how a subsystem performs
the task assigned to it, rather they should only know what task a subsystem does
(c) Each subsystem should be self-contained and independent
(d) Each subsystem should know what other subsystems do and how to send requests
to them for assistance so that it can cooperate with them to get its own job done
(e) Subsystem should hide from outside world the data it uses
(f) The subsystem should be designed to be reusable
9.2 Why is object-oriented modelling used in practice?
Object-oriented modelling is used in practice as it
Facilitates changing of system to improve functionality during the system life
time
Facilitates reuse of code of each of the subsystems used to design the large
system
Facilitates integrating subsystems into a large system
Facilitates design of distributed systems
9.3 When is objected-oriented modelling particularly useful?
An object-oriented modelling is particularly useful in the following situations:
It is required to change an existing system by adding new functionality
While designing large system and it is found that it can be designed as a
collection of existing reusable objects
9.4 Define an object.
An object is an entity, which is uniquely identifiable and permanent relative to the
life time cycle of an application. It may be tangible or intangible. Examples of
tangible objects are bus, student etc. Examples of intangible objects are bank
account, queue data structure etc.
9.5 What is the difference between a class and an object?
A class can be termed as a group of objects having similar behavior and similar
attributes. A class is a template or blueprint, which defines all the properties and attributes
that an object belonging to it possess. An object is a particular instance of a class. Each
object has values assigned to its attributes.
9.6 What are subclasses and superclasses? Give examples of each of these
Subclasses are classes which have some common attributes and operations inherited
from parent class. The parent class is called superclass.
There may be more than one superclass for a subclass. Though the operations in
subclasses are same as superclasses but they may be interpreted in a different way. A
subclass overrides the functionality of superclass.
For example, if class furniture is a superclass then its subclasses are tables, chairs,
cots etc.
A vehicle is a superclass and its subclasses may be cycle, scooter, car, buses etc.
9.7 What do you understand by information hiding? Why is it resorted to in designing
information systems? How is it achieved?
System Analysis and Design /Object Oriented System Modeling Worked Out Problems
Information hiding is the way of hiding the implementation details of an object from
the outside world. Any changes in the way the operations are performed by an object
is not visible to the client and vice-versa. An object can change the code used by it
without affecting the functionality of client. It is achieved by specifying the
operations which an object can perform and publicising them.
9.8 What do you mean by inheritance in object-oriented systems? Why is it useful?
Give an example of inheritance.
Inheritance is a technique by which the properties and attributes of a class are
inherited by a subclass. With inheritance we can refine the subclasses by adding
some new attributes and functionality.
For Example, the Employee class shown below is the superclass and the classes
Salesman and Accounts_Assistant are inherited classes.
Attributes Emp_no
Emp_name
Address
Date_of_joining
Operations Calculate_salary()
Calculate_incometax()
Emp_no Emp_no
Emp_name Emp_name
Address Attributes Address
Date_of_joining Date_of_joining
Dept. Dept.
System Analysis and Design /Object Oriented System Modeling Worked Out Problems
two weeks before the expiry of the subscription, the subscribers name is removed from
the mailing list and subscriber is informed.
System Analysis and Design /Object Oriented System Modeling Worked Out Problems
Class Class
Magazine_publishing Magazine_subscn_acc Send ack
company Send the ounts Send cheque
magazine Request_Subscn
and mag_id
Subscriber
Collaboration graph
9.11 Give brief requirements specification for a bus ticket reservation system. Model
it using objects.
For making reservation for a bus a passenger has to fill-up a form, which has field
specifications like name, address, date of journey, destination etc. After filling up the
form the ticket is issued from the counter after checking for the availability of the
seats. A passenger has an option to cancel his ticket.
The two classes taken here are ticket class and bus class. The ticket class sends a
message to bus class regarding the availability of seats and gets the confirmation
from the bus class.
Class: Ticket
Attributes: Bus_No
Ticket_No
Date_of_issue
Date_of_journey
Starting_Point
Destination
Passenger_Name
Fare
Departure_Time
Checkin_Time
System Analysis and Design /Object Oriented System Modeling Worked Out Problems
Operation: Issue_ticket()
Cancel_ticket()
Query()
Class: Bus
Attributes: Bus_No
No_of_Seats
Availability
Route_No
Operation: Confirm()
Class: Passenger
Attributes: Passenger_Name
Address
Ph. No
Date_of_Journey
Bus_No
Route_No
Operation: Booking_Ticket()
Ticket Class
Class: Ticket
Superclass: None
Subclass: None
Collaborators: Bus, Passenger
Description: Issue ticket to the passenger
Private responsibilities:
Issue the ticket to the passenger if it is confirmed
Cancel the ticket and return the money
Contractor(s) and collaborator(s)
Send the query to Bus class for getting the status
Passenger Class
Class: Passenger
System Analysis and Design /Object Oriented System Modeling Worked Out Problems
Superclass: None
Subclass: None
Collaborator(s): Bus
Description: This class gets the details about availability of bus and seats
Private responsibilities:
Contractor(s) and Collaborator(s):
Send query to the bus class to get the bus no. and the availability of bus
and seats
Bus Class
Class: Bus
Superclass: None
Subclass: None
Collaborator(s): passenger, Ticket
Description: Send the information regarding status of bus and seats
Private responsibilities:
Contractor(s) and collaborator(s):
Send the confirmation regarding the availability of seats and bus to the
passenger and ticket class
Book the
ticket
Get the status of the bus
Cancel
Ticket
Confirm
Collaboration graph
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
c. i, iii, iv
d. i, ii, iii, iv
9.11 In UML diagram of a class
a. state of object cannot be represented
b. state is irrelevant
c. state is represented as an attribute
d. state is represented as a result of an operation
9.12 Attributes are assigned value
a. when operations are performed on an object
b. when instances of objects are defined
c. when methods are invoked
d. when classes are identified
9.13 The following are intangible entities which can be defined as objects
(i) a motor car
(ii) a bank account
(iii) an aircraft
(iv) a linked list
a. i, ii
b. ii, iv
c. iii, iv
d. ii, iii, iv
9.14 A query operation on a object
a. has side effect
b. has no side effects
c. changes the state of an object
d. is not allowed
9.15 An instance of an object is created by a
a. query operation
b. update operation
c. constructor operation
d. open operation
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
System Analysis and Design/ Object-Oriented System Modeling Multiple Choice Questions
System Analysis and Design /Object Oriented System Modeling Question Bank
Question Bank
9.6 What are subclasses and superclasses. Give examples of each of these.
9.8 What do you mean by inheritance in object oriented systems? Why is it useful?
9.9 What do you understand by the term polymorphism in object oriented system?
9.10 How do you select objects from a requirement specification. Given the following
A list of employers with their basic pay is sent to a clerk. He calculates the gross
pay using standard allowances which are known for each pay slab. Deduction
statements such as loan repayment, subscription to association etc., are also sent
to another clerk who matches these slips with the slips of gross pay and calculates
net pay. This step is used by another clerk to write out pay cheques for each
employee and sent to respective employees. The total pay bills computed is also
computed".
9.11 Pick objects and model the following requirements statement using objects. "A
magazine is printed monthly and posted to its subscribers. Two months before the
System Analysis and Design /Object Oriented System Modeling Question Bank
received upto two weeks before the expiry of the subscription, the subscriber's
name is removed from the mailing list and the subscriber informed".
9.12 Give a brief requirement specification for a bus ticket reservation system. Model
it using objects.
References
1. Most of the material in this module has been taken from the book Analysis and
New Delhi, 2003. Chapter 13, Object Oriented System Modelling (pp.180-199)
2. There are several standard books on object oriented modeling for those who want to
(ii) David Colemen et.al Object Oriented Development, Prentice Hall, Inc.,
N.J., WA,1999