Mca 503
Mca 503
Mca 503
Rajender Nath
Vetter: Dr. Dharminder Kumar
Chapter 1
Structure
1.0 Introduction
1.1 Objectives
1.2 Introduction To Modeling
1.2.1 What is modeling
1.2.2 Why do we model?
1.3 Object Oriented Methodologies
1.3.1 Object Oriented Process
1.3.1.1 System Analysis
1.3.1.2 System Design
1.3.1.3 Object Design
1.3.1.4 Implementation
1.3.2 Advantages of Object Oriented Methodologies
1.4 OMT Methodology
1.4.1 Object Model
1.4.1.1 Object and Classes
1.4.1.2 Links and Associations
1.5 Summary
1.6 Suggested Readings/Reference Materials
1.7 Self-Assessment Questions
1
1.0 Introduction
Object Oriented Philosophy is very much similar to real world and hence is
gaining popularity as the systems here are seen as a set of interacting objects
as in the real world. To implement this concept, the process-based structural
programming is not used; instead objects are created using data structures.
Just as every programming language provides various data types and various
variables of that type can be created, similarly, in case of objects certain data
types are predefined.
1.1 Objectives
2
model, dynamic model and functional model. Concepts of objects and classes
are discussed in detail along with the notations of OMT methodology. Links
and associations are defined and illustrated with lucid examples.
Most modeling techniques used for analysis and design involve graphic
languages. These graphic languages are made up of sets of symbols. As you
know one small line is worth thousand words. So, the symbols are used
according to certain rules of methodology for communicating the complex
relationships of information more clearly than descriptive text.
Modeling is used frequently, during many of the phases of the software life
cycle such as analysis, design and implementation. Modeling like any other
object-oriented development, is an iterative process. As the model
progresses from analysis to implementation, more detail is added to it.
3
Before constructing anything, a designer first build a model. The main
reasons for constructing models include:
4
During design, overall architecture of the system is described. During
implementation phase, the class objects and the interrelationships of these
classes are translated and actually coded using the programming language.
The databases are created and the complete system is made operational.
The OOM for building systems takes the objects as the basis. For this, first
the system to be developed is observed and analyzed and the requirements
are defined. Once this is done, the objects in the required system are
identified. For example, in case of a Banking System, a customer is an object,
a ledger is an object, passbook is an object and even an account is an object.
• System Analysis
• System Design
• Object Design
• Implementation
As in any other system development model, system analysis is the first phase
of OOM too. In this phase, the developer interacts with the user of the system
to find out the user requirements and analyses the system to understand the
functioning of it.
Based on this system study, the analyst prepares a model of the desired
system. This model is purely based on what the system is required to do. At
this stage the implementation details are not taken care of. Only the model of
the system is prepared based on the idea that the system is made up of a set
of interacting objects. The important elements of the system are emphasized.
5
1.3.1.2 System Design
System Design is the next development stage in OOM where the overall
architecture of the desired system is decided. The system is organized as a
set of sub systems interacting with each other. While designing the system as
a set of interacting subsystems, the analyst takes care of specifications as
observed in system analysis as well as what is required out of the new system
by the end user.
In this phase, the details of the system analysis and system design are
implemented. The Objects identified in the system design phase are
designed. Here the implementation of these objects is decided in the form of
data structures required and the interrelationships between the objects. For
example, we can define a data type called customer and then create and use
several objects of this data type. This concept is known as creating a class.
In this phase of the development process, the designer also decides about the
classes in the system based on these concepts. He decides on whether the
classes need to be created from scratch or any existing classes can be used
as it is or new classes can be inherited from them.
1.3.1.4 Implementation
During this phase, the class objects and the interrelationships of these
classes are translated and actually coded by using an object-oriented
programming language. The required databases are created and the
complete system is transformed into operational one.
6
1.3.2 Advantages of Object Oriented Methodology
7
• OOM approach is more natural as it deals with the real world objects.
So, it provides nice structures for thinking and abstracting and leads to
modular design.
Many OOMs have been developed since its inception. Some of the popular
object oriented methodologies are listed below:
Other Object-Oriented methodologies that have been around in the world are:
8
is the part of your syllabus and will be discussed in detail in rest of the
chapters.
The object model describes the static, structural and data aspects of a
system. The dynamic model describes the temporal, behavioral and control
aspects of a system. The functional model describes the transformational and
functional aspects of a system. So every system has these three aspects.
Each model describes one aspect of the system but contains references to
the other models.
The entire OMT software development process has four phases: analysis,
system design, object design, and implementation of the software. Most of the
modeling is performed in the analysis phase. In this phase, three basic
models - Object Model, Dynamic Model and Functional Model are developed.
While the Object Model is most important of all as it describes the basic
element of the system, the objects, all the three models together describe the
complete functional system.
9
describes the data transformations of the system. This describes the flow of
data and the changes that occur to the data throughout the system.
In this chapter, we will discuss the object model in detail. Remaining models
will be described in the ensuing chapters.
The object model describes the structure of the objects in the system - their
identity, their relationships to other objects, their attributes, and their
operations. The object model depicts the primary view of how the real world in
which the system interacts is divided and the overall decomposition of the
system. The object model provides the framework into which the other models
are placed.
10
Classes are built on the basis of abstraction, where a set of similar objects is
observed and their common characteristics are listed. Of all these, the
characteristics of concern to the system under observation are taken and the
class definition is made. The attributes of no concern to the system are left
out. This is known as abstraction. So, the abstraction is the process of hiding
superfluous details and highlighting pertinent details in respect to the system
under development.
Each application-domain concept from the real world that is important to the
application should be modeled as an object class. Classes are arranged into
hierarchies sharing common structure and behavior and are associated with
other classes. This gives rise to the concept of inheritance.
11
ClassName
Attribute-name1:data-type1=default-val1
Attribute-name2:data-type2=default-val2
Operation-name1(arguments1):result-type1
Operation-name2(arguments2):result-type2
Figure 1.1
12
provided by object-oriented programming languages are all examples of
polymorphic operations. A method is the implementation of an operation for a
class. The method depends only on the class of the target object.
Book
title: string
author:string
publisher:string
open()
close()
read()
Figure 1.2
Person
name:string
address:string
phone:integer
changeName()
changeAddress()
changePhone()
Figure 1.3
Figure 1.3 shows the class Person with name, address & phone along with
their data types as attributes and changeName(), changeAddress() &
changePhone() as operations.
13
Figure 1.4 shows the class Window with xMin, yMin, xMax, yMax along with
their data types as attributes and draw(), cut(), erase() & move() as
operations.
Window
xMin:integer
yMin:integer
xMax:integer
yMax:integer
draw()
cut()
erase()
move()
Figure 1.4
• Unique identification
• Set of attributes
• Set of states
• Set of operations (behavior)
14
In other words, an object is an instance of an object class. Figure 1.2
(rounded box) represents an object instance in OMT. Object instance is a
particular object from an object class. The box may/may not be divided in
particular regions. Object instances can be used in instance diagrams, which
are useful for documenting test cases and discussing examples.
(ClassName)
Figure 1.5
object name
Figure 1.5
Now we give three examples of objects of class Book shown in Figures 1.2,
which are shown in Figure 1.6 (a), (b) & (c) respectively.
Here we give three examples of objects of class Person shown in Figures 1.3,
which are shown in Figure 1.7 (a), (b) & (c) respectively.
15
(Window) (Window) (Window)
excel word access
After having discussed the concepts of objects and their classes, let us
discuss relationships between objects and between classes.
Figure 1.9
For example Mayank flies Jaguar. So ‘flies’ is a link between object instance
Mayank of class Person and object instance Jaguar of class Airplane as
shown in Figure 1.10. Kartik reads Physics. Here reads is a link between
object instance Kartik of class Person and object instance Physics of class
Book as shown in Figure 1.11.
16
(Person) (Airplane)
Mayank flies Jaguar
Figure 1.10
Figure 1.11
Figure 1.12
17
There are special line terminators to indicate certain common multiplicity
values. A solid ball is the symbol for "many", meaning zero, one or more. A
hollow ball indicates "optional", meaning zero or one. The multiplicity is
indicated with special symbols at the ends of association lines. In the most
general case, multiplicity can be specified with a number or set of intervals. If
no multiplicity symbol is specified that means a one-to-one association. The
rules of multiplicity are summarized below:
Association-name
Class-Name
*********
Figure 1.13
18
teaches
Person
*********
Figure 1.14
Figure 1.15
********* *********
Figure 1.16
19
Supplier supplies Parts
********* *********
Figure 1.17
********* *********
Figure 1.18
********* *********
Figure 1.19
20
written next to the diamond. An n-ary associations cannot be subdivided into
binary associations without losing information.
Class-Name
Class-Name
Class-Name
Figure 1.20
There are many other concepts related to associations such as link attribute,
link class, role names, qualifiers etc. which will be discussed in the next
chapter.
21
Programmer
Project
Language
Figure 1.21
1.5 Summary
In this chapter you have learnt the concepts of model, object modeling, OMT
methodology, object model, dynamic model, functional model, class, object,
link and association, which are summarized below:
22
• The functional model describes the transformational and functional
aspects of a system.
• Every system has all the three models. Each model describes one
aspect of the system but at the same time contains references to the
other models.
• An object is a concept, abstraction, or thing with crisp boundaries and
meaning for the problem at hand.
• An object has the following four main characteristics - unique
identification, set of attributes, set of states, and set of operations
(behavior).
• Class is a template where certain basic characteristics of a set of
objects are defined. A class defines the basic attributes and the
operations of the objects of that type.
• Defining a class does not define any object, but it only creates a
template. For objects to be actually created, instances of the class are
to be created as per the requirement of the case.
• A link is a physical or conceptual connection between object instances.
In OMT, link is represented by a line labeled with its name.
• An association describes a group of links with common structure and
common semantics between two or more classes. Association is
represented by a line labeled with the association name in italics.
• An association may be unary, binary, ternary or n-ary.
• Multiplicity specifies how many instances of one class may relate to a
single instance of an associated class.
23
4. Timothy C. Lethbridge, Robert Laganiere, Object Oriented Software
Engineering, TMH, 2004
24
Writer: Dr. Rajender Nath
Vetter: Dr. Dharminder Kumar
Chapter 2
Advanced Object Modeling
Structure
2.0 Introduction
2.1 Objectives
2.2 Presentation of Contents
2.2.1 Link Attributes
2.2.2 Role Names
2.2.3 Ordering
2.2.4 Qualification
2.2.5 Aggregation
2.2.6 Inheritance
2.2.6.1 Inheritance for specialization
2.2.6.2 Inheritance for generalization
2.2.6.3 Inheritance for extension
2.2.6.4 Inheritance for restriction
2.2.6.5 Inheritance for overriding
2.2.6.6 Constraints of Inheritance-based Design
2.2.6.7 Roles and Inheritance
2.2.7 Types of Inheritance
2.2.7.1 Single Inheritance
2.2.7.2 Multiple Inheritance
2.2.7.3 Multilevel Inheritance
2.2.7.4 Hierarchical Inheritance
2.2.7.5 Multipath Inheritance
2.2.7.6 Hybrid Inheritance
2.2.8 Grouping Constructs
2.3 Summary
25
2.4 Suggested Readings/Reference Materials
2.5 Self-Assessment Questions
25
2.0 Introduction
2.1 Objectives
In the last chapter, a foundation of object model was created. The objective of
this chapter is to introduce advanced concepts of object modeling such as link
attributes, link class, role names, ordering qualifiers etc. you will also learn
other relationships between classes such as aggregation and inheritance. At
the end of this chapter, you will be able to answer what is aggregation? What
is recursive aggregation? What are different types of inheritance? You will
also learn the concepts of metadata, candidate keys and grouping constructs.
25
The OMT notation for a link attribute is a box attached to the association by a
loop, see Figure 2.1.
Attribute Name 1
Attribute Name 2
**************
Figure 2.1
One or more link attributes may appear in the second region of the box.
Sometime it is possible, for one-to-one and one-to-may associations, to fold
link attributes into the class opposite to the "one" side. But as a rule, link
attributes should not be folded into a class because future flexibility is reduced
if the multiplicity of the association changes.
25
AccessedBy
File User
access-permission
Figure 2.2
Class Name
***********
Figure 2.3
Accessible by
File User
Authorization
access-permission
grantPermission()
changePermsission()
Figure 2.4
25
Now, consider the example shown in Figure 2.4, where whole class is
associated with the link. In this example, the class Authorization is a link
class. It has one attribute “access-permission” and two methods
grantPermission() and changePermission().
A role is one end of an association. A binary association can have two roles,
each of which may have a role name. A role name is a name that uniquely
identifies one end of an association. Roles provide a way of viewing a binary
association as a traversal from one object to a set of associated objects. Each
role on a binary association identifies an object or set of objects associated
with an object at the other end. Figure 2.5 shows how to represent roles in
OMT methodology.
Figure 2.5
The use of role names is optional, but is often easier and less confusing to
assign role names instead of, or in addition to, association names. Role
names are necessary for associations between two objects of the same class.
They are also useful to distinguish between two associations between the
same pair of classes. We can follow these two guidelines: All role names on
the far end of associations attached to a class must be unique. No role name
should be the same as an attribute name of the source class. It is also
possible to use role names for n-ary associations.
The role name is a derived attribute whose value is a set of related objects.
Use of role names provides a way of traversing associations from an object at
one end, without explicitly mentioning the association.
25
For example, consider the association ‘a person works for a company’, in this
employee and employer are role names for the classes Person and Company
respectively as shown in Figure 2.6.
Figure 2.6
2.2.3 Ordering
{Ordered}
ClassName ClassName
********** association name
**********
Figure 2.7
{ordered}
Window Visible-on Screen
Figure 2.8
25
2.2.4 Qualification
Figure 2.9
The qualifier is drawn as a small box on the end of the association line near
the class it qualifies. The qualifier rectangle is part of the association, not of
class. The qualifier distinguishes among the set of objects at the "many" end
of an association. A qualified association can also be considered a form of
ternary association. The advantage of the qualification is that it improves
semantic accuracy and increases the visibility of navigation paths.
Figure 2.10
2.2.5 Aggregation
25
of” relationship in which objects representing the component of something are
associated with an object representing the entire assembly. Aggregations are
drawn like associations, except a small hollow diamond indicating the
assembly end of the relationship as shown in Figure 2.11. The class opposite
to the diamond side is part of the class on the diamond side.
Figure 2.11
Team Players
Figure 2.12
25
Program
Block
Compound Simple
statement statement
Figure 2.13
Figure 2.15
Company
Division
Section
25
Document
Paragraph
Sentence
Word
Character
Figure 2.15
2.2.6 Inheritance
The inheritance concept was invented in 1967 for Simula. Inheritance is a way
to form new classes using classes that have already been defined.
Inheritance is intended to help reuse existing code with little or no
modification. The new classes, known as derived classes (or child classes or
sub classes), inherit attributes and behavior of the pre-existing classes, which
25
are referred to as base classes (or parent classes or super classes) as shown
in Figure 2.16. The inheritance relationship of sub- and super classes gives
rise to a hierarchy.
AttributeName1
AttributeName2
………..
OperationName1()
OperationName2()
….....
Derived Class/Sub
Class/Child Class
AttributeName1
AttributeName2
………..
OperationName1()
OperationName2()
….....
Figure 2.16
25
Employee
empID
name
………..
getEmpID()
getName()
….....
Manager
department
phone
………..
getDept()
getPhone()
….....
Figure 2.17
25
also, Circle class is specialization of Ellipse class. Another example, a
BankAccount class might have data members such as accountNumber,
customerName and balance. An InterestBearingAccount class might inherit
BankAccount and then add data member interestRate and interestAccrued
along with behavior for calculating interest earned.
Another form of specialization occurs when a base class specifies that it has a
particular behavior but does not actually implement the behavior. Each non-
abstract, concrete class which inherits from that abstract class must provide
an implementation of that behavior. This providing of actual behavior by a
subclass is sometimes known as implementation or reification.
For example, there is a class Shape having operation area(). The operation
area() cannot be implemented unless we have concrete class. So, Shape
class is abstract class. Rectangle is a Shape. Now, Rectangle is a concrete
class, which can implement the operation area().
Vehicle
Figure 2.18
25
Another example: Vehicle is a generalization of Car, Truck, Bus etc. as shown
in Figure 2.18. Car, Truck, Bus etc. share some properties such as “number of
wheels”, speed, capacity etc. these common properties are abstracted out
and put into another class say Vehicle, which comes higher in the hierarchy.
For example, StringSet class inherits from Set class, which specializes for
holding string values. Such a class might provide additional methods for string
related operations – for instance - search by prefix, which returns a subset of
all the elements of the set that begin with a certain string value. These
operations are meaningful to the derived class but are not particularly relevant
to the base class.
In this case, the derived class does not implement the functionality, which a
base class has. In other words, inheritance for restriction occurs when the
behavior of the derived class is smaller or more restrictive than the behavior
of the base class.
25
class and can modify or override the undesired methods so that they produce
an error message if used.
• Singleness: Using single inheritance, a subclass can inherit from only one
superclass. Continuing the example given above, Person can be either a
Student or an Employee, but not both. Using multiple inheritance partially
solves this problem, as a StudentEmployee class can be defined that
inherits from both Student and Employee. However, it can still inherit from
each superclass only once; this scheme does not support cases in which a
student has two jobs or attends two institutions.
• Static: the inheritance hierarchy of an object is fixed at instantiation when
the object's type is selected and does not change with time. For example,
the inheritance graph does not allow a Student object to become a
25
Employee object while retaining the state of its Person superclass.
(Although similar behavior can be achieved with the decorator pattern.)
Some have criticized inheritance, contending that it locks developers into
their original design standards.
• Visibility: whenever client code has access to an object, it generally has
access to all the object's superclass data. Even if the superclass has not
been declared public, the client can still cast the object to its superclass
type. For example, there is no way to give a function a pointer to a
Student's grade point average and transcript without also giving that
function access to all of the personal data stored in the student's Person
superclass.
25
in", such that an instance of a Person is in employee role, when he works-in a
job, where a job is a role of his work place in the situation when the employee
works in it.
Note that in this approach, all classes that are produced by this design
process are part of the same domain, that is, they describe things clearly
using just one terminology. This is often not true for other approaches.
So, if you would look at a Student object, you would see attributes of name,
date of birth, parents, children, and student ID as shown in Figure 2.19.
Figure 2.19
25
2.2.7 Types of Inheritance
There are many ways a derived class inherits properties from the base class.
Following are the types of inheritance:
• Single Inheritance
• Multiple Inheritance
• Multilevel Inheritance
• Hierarchical Inheritance
• Multipath Inheritance
• Hybrid Inheritance
Person
name
address
………..
getName()
getAddress()
….....
Student
rollNo
course
………..
getRollNo()
getCourse()
….....
Figure 2.20
25
When a (derived) class inherits properties (data and operations) from a single
base class, it is called as single inheritance. For example, Student class
inherits properties from Person class as shown in Figure 2.20.
When a (derived) class inherits properties (data and operations) from more
than one base class, it is called as multiple inheritance. For example,
BoatHouse class inherits properties from both Boat class and House class as
shown in Figure 2.21.
Boat House
BoatHouse
Figure 2.21
When a (derived) class inherits properties (data and operations) from another
derived class, it is called as multilevel inheritance. For example, Rectangle
class inherits properties from Shape class and Square inherits properties from
Rectangle class as shown in Figure 2.22.
25
Shape
Rectangle
Square
Figure 2.22
When more than one (derived) class inherits properties (data and operations)
from a single base class, it is called as hierarchical inheritance. For example,
Chair class, Table class and Bed class all inherit properties from Furniture
class as shown in Figure 2.23.
Furniture
Figure 2.23
25
2.2.7.5 Multipath Inheritance
When more than one inheritance paths are available between two classes in
the inheritance hierarchy, it is called as multipath inheritance. For example,
Carnivorous and Herbivorous class inherit properties from Animal class.
Omnivorous class inherits properties from Carnivorous and Herbivorous
classes. So, there are two alternative paths available from Animal class to
Omnivorous class as shown in Figure 2.24.
Animal
Carnivorous Herbivorous
Omnivorous
Figure 2.24
C Ook
C++ Java
C#
Figure 2.25
25
2.2.7.6 Hybrid Inheritance
A sheet is a single printed page. Sheet is the mechanism for breaking a large
object model into a series of pages. Each module is contained in one or more
sheets. Sheet numbers or sheet names inside circle contiguous to a class box
indicate other sheets that refer to a class.
2.3 Summary
25
• A qualifier is an association attribute. A qualified association relates
two object classes and a qualifier. The qualifier is a special attribute
that reduces the effective multiplicity of an association. One-to-many
and many-to-many associations may be qualified.
25
a. Generalization and Specialization
b. Inheritance and Aggregation
7. Comment on “Inheritance for extension or restriction”.
8. What are different types of inheritance? Explain them with two
examples of each.
9. Discuss different types of grouping constructs.
25
Writer: Dr. Rajender Nath
Vetter: Dr. Dharminder Kumar
Chapter 3
Dynamic Modeling
Structure
3.0 Introduction
3.1 Objectives
3.2 Presentation of Contents
3.2.1 Dynamic Modeling
3.2.1.1 Scenario
3.2.1.2 Event-Trace Diagram
3.2.1.3 State Machine
3.2.1.3.1 State
3.2.1.3.2 Event
3.2.1.3.3 Transition
3.2.1.3.4 Action
3.2.1.3.5 Activity
3.2.1.4 State Diagram
3.2.1.4.1 When to use state diagrams
3.2.1.4.2 How to draw state diagrams
3.3 Summary
3.4 Suggested Readings/Reference Materials
3.5 Self-Assessment Questions
3.0 Introduction
The complete OOM revolves around the objects identified in the system. When
observed closely, every object exhibits some characteristics and behavior. The
objects recognize and respond to certain events. For example, considering a
Window on the screen as an object, the size of the window gets changed when
resize button of the window is clicked. Here the clicking of the button is an event to
which the window responds by changing its state from the old size to the new size.
While developing systems based on this approach, the analyst makes use of certain
models to analyze and depict these objects.
The dynamic model represents a state/transition view on the model. Main concepts
are states, transitions between states, and events to trigger transitions. Actions can
be modeled as occurring within states. Generalization and aggregation
(concurrency) are predefined relationships. The outcomes of a dynamic model are
scenarios, event-trace diagrams and sate diagrams.
3.1 Objectives
In this chapter you will learn what is dynamic model and concepts related to dynamic
modeling such as event, state, state transition, action and activity. You will also learn
how to model dynamic behavior of a system through scenario, event-trace diagram
and state diagram.
Dynamic model describes those aspects of the system that changes with the time. It
is used to specify and implement control aspects of the system. It depicts states,
transitions, events and actions. The dynamic model includes event trace diagrams
describing scenarios. An event is an external stimulus from one object to another,
which occurs at a particular point in time. An event is a one-way transmission of
information from one object to another. A scenario is a sequence of events that
occurs during one particular execution of a system. Each basic execution of the
system should be represented as a scenario.
The outcomes of dynamic modeling are scenario, event-trace diagram and state
diagram. These are discussed one by one in detail in the following sections.
3.2.1.1 Scenario
Figure 3.1 shows a scenario to use ATM for withdrawing money. Each event
transmits information from one object to another. For example, the event “the ATM
asks the user to insert a card” transmits a signal from the ATM to the User. The next
event is “the user inserts a cash card”. The next event is “the ATM accepts the card
and reads its serial no.” and so on.
Normal ATM scenario
2. The ATM accepts the card and reads its serial number.
4. The ATM verifies the serial number and password with the
consortium
The consortium checks it with bank ABC and notifies the
ATM of acceptance
Figure 3.1
The limitation of scenario is that it is not clear from scenario, how many objects are
involved and which object generates an event and which object receives an event.
To overcome this limitation, an event-trace diagram is introduced. In the event-trace
diagram, the sequence of events and the objects exchanging events both can be
shown. The diagram shows each object as a vertical line and each event as a
horizontal arrow from the sender object to the receiver object. Time increases from
top to bottom. Spacing between horizontal arrows carries no information. Figure 3.2
below shows the event-trace diagram for interaction with the ATM.
In this diagram, four objects – User, ATM, Consortium and Bank - are involved,
which are shown with four vertical lines. User generates an event “insert card” which
is shown as horizontal arrow from user to ATM. That means source of the event is
User object and destination of the event is ATM. In response to this event, the ATM
generates the “request password” event to the User. Spacing between these two
arrows is insignificant but the event “insert card” occurs before the event “request
password” and so on.
Figure 3.2
3.2.1.3 State Machine
A state machine is a behavior which specifies the sequence of states an object visits
during its lifetime in response to events, together with its responses to those events.
Now, we describe the various concepts related to state machine in the following
subsections.
3.2.1.3.1 State
A state is a condition during the life of an object during which it satisfies some
condition, performs some activity, or waits for some external event. A state
corresponds to the interval between two events received by an object and describes
the "value" of the object for that time period. A state is an abstraction of an object's
attribute values and links, where sets of values are grouped together into a state
according to properties that affect the general behavior of the object. For instance,
stack is empty or stack is full are different states of the object stack. As state
corresponds to interval between two events received by an object so it has duration.
A substate is a state that is nested in another state. A state that has substates is
called a composite state. A state that has no substates is called a simple state.
Substates may be nested to any level.
3.2.1.3.2 Event
A transition is a relationship between two states indicating that an object in the first
state will, when a specified set of events and conditions are satisfied, perform certain
actions and enter the second state. Transition can be self-transition. It is a transition
whose source and target states are the same.
If a transition is to a composite state, the nested state machine must have an initial
state. If a transition is to a substate, the substate is entered after any entry action for
the enclosing composite state is executed followed by any entry action for the
substate.
If a transition is from a substate within the composite state, any exit action for the
substate is executed followed by any exit action for the enclosing composite state. A
transition from the composite state may occur from any of the substates and takes
precedence over any of the transitions for the current substate.
3.2.1.3.4 Action
3.2.1.3.5 Activity
State diagrams are used to describe the behavior of a system. State diagrams
describe all of the possible states of an object as events occur. Each diagram
usually represents objects of a single class and tracks the different states of its
objects through the system.
Use state diagrams to demonstrate the behavior of an object through many use
cases of the system. Only use state diagrams for classes where it is necessary to
understand the behavior of the object through the entire system. Not all classes will
require a state diagram and state diagrams are not useful for describing the
collaboration of all objects in a use case. State diagrams are combined with other
diagrams such as interaction diagrams and activity diagrams.
State diagrams have very few elements. The basic elements are rounded boxes
representing the state of the object and arrows indicting the transition to the next
state. The activity section of the state symbol depicts what activities the object will
be doing while it is in that state as shown Figure 3.3 below.
Figure 3.3
Initial and Final States: All state diagrams being with an initial state of the object as
shown in Figure 3.4. This is the state of the object when it is created. After the initial
state the object begins changing states. Conditions based on the activities can
determine what the next state the object transitions to.
Figure 3.4
The initial state is denoted by a filled black circle and may be labeled with a name.
The final state is denoted by a circle with a dot inside and may also be labeled with a
name as shown in Figure 3.5.
Figure 3.5
Transitions: Transitions from one state to the next are denoted by lines with
arrowheads. A transition may have a trigger, a guard and an effect, as shown in
Figure 3.6 below.
Figure 3.6
"Trigger" is the cause of the transition, which could be a signal, an event, a change
in some condition, or the passage of time. "Guard" is a condition which must be true
in order for the trigger to cause the transition. "Effect" is an action which will be
invoked directly on the object that owns the state machine as a result of the
transition.
State Actions: In the transition example above, an effect was associated with the
transition. If the target state had many transitions arriving at it, and each transition
had the same effect associated with it, it would be better to associate the effect with
the target state rather than the transitions. This can be done by defining an entry
action for the state. The diagram in Figure 3.7 below shows a state with an entry
action and an exit action. It is also possible to define actions that occur on events, or
actions that always occur. It is possible to define any number of actions of each type.
Figure 3.7
Self-Transitions: A state can have a transition that returns to itself, as shown in the
Figure 3.8. This is the most useful when an effect is associated with the transition.
Figure 3.8
Compound States: A substate is a state that is nested in another state. A state that
has substates is called a composite state. A state that has no substates is called a
simple state. Substates may be nested to any level.
The notation in the above version indicates that the details of the Check PIN sub-
machine are shown in a separate diagram.
Figure 3.8
Figure 3.9
Entry Point: Sometimes you won’t want to enter a sub-machine at the normal initial
state. For example, in the sub-machine shown in Figure 3.10, it would be normal to
begin in the “Initializing” state, but if for some reason it wasn’t necessary to perform
the initialization, it would be possible to begin in the “Ready” state by transitioning to
the named entry point.
Figure 3.10
Figure 3.11
Choice Pseudo-State: A choice pseudo-state is shown as a diamond with one
transition arrives and two or more transitions leaving. The Figure 3.12 shows that
whichever state is arrived at, after the choice pseudo-state, is dependent on the
message format selected during execution of the previous state.
Figure 3.12
Figure 3.13
Junction Pseudo-State: Junction pseudo-states as shown in Figure 3.13 are used to
chain together multiple transitions. A single junction can have one or more incoming,
and one or more outgoing, transitions; a guard can be applied to each transition.
Junctions are semantic-free. A junction, which splits an incoming transition into
multiple outgoing transitions realizes a static conditional branch, as opposed to a
choice pseudo-state which realizes a dynamic conditional branch.
Figure 3.14
Figure 3.15
History States: A history state is used to remember the previous state of a state
machine when it was interrupted. The diagram shown in Figure 3.15 illustrates the
use of history states. The example is a state machine belonging to a washing
machine.
In this state machine, when a washing machine is running, it will progress from
"Washing" through "Rinsing" to "Spinning". If there is a power cut, the washing
machine will stop running and will go to the "Power Off" state. Then when the power
is restored, the Running state is entered at the "History State" symbol meaning that it
should resume where it last left-off.
Concurrent Regions: A state may be divided into regions containing sub-states that
exist and execute concurrently. Figure 3.16 shows that within the state “Applying
Brakes”, the front and rear brakes will be operating simultaneously and
independently. Notice the use of fork and join pseudo-states, rather than choice and
merge pseudo-states. These symbols are used to synchronize the concurrent
threads.
Figure 3.16
A state machine diagram models the behavior of a single object, specifying the
sequence of events that an object goes through during its lifetime in response to
events.
As an example, the following state machine in Figure 3.17 shows the states that a
door goes through during its lifetime.
Figure 3.17
The door can be in one of three states: "Opened", "Closed" or "Locked". It can
respond to the events Open, Close, Lock and Unlock. Notice that not all events are
valid in all states; for example, if a door is opened, you cannot lock it until you close
it. Also notice that a state transition can have a guard condition attached: if the door
is Opened, it can only respond to the Close event if the condition door Way->isEmpty
is fulfilled.
Let us take another example of the state diagram for an Order object as shown in
Figure 3.18. When the object enters the Checking state it performs the activity
“check items.” After the activity is completed the object transitions to the next state
based on the conditions [all items available] or [an item is not available]. If an item is
not available the order is canceled. If all items are available then the order is
dispatched. When the object transitions to the Dispatching state the activity “initiate
delivery” is performed. After this activity is complete the object transitions again to
the Delivered state.
Figure 3.18
State diagrams can also show a super-state for the object. A super-state is used
when many transitions lead to a certain state. Instead of showing all of the
transitions from each state to the redundant state a super-state can be used to show
that all of the states inside of the super-state can transition to the redundant state.
This helps make the state diagram easier to read.
Figure 3.19
Figure 3.19 shows a super-state. Both the Checking and Dispatching states can
transition into the Canceled state, so a transition is shown from a super-state named
Active to the state Cancel. By contrast, the state Dispatching can only transition to
the Delivered state, so we show an arrow only from the Dispatching state to the
Delivered state.
Another illustrative example of state diagram is shown in Figure 3.20 below. It shows
the bank transaction and verification of bank account. Activities are shown in the
state such as do: update account, do: verify card number and do: verify password.
Diagram also shows initial and final states.
Figure 3.20
Now, we consider one more example of state diagram for phone line is shown Figure
3.21. A phone can have many states such as idle, dial tone, dialing, connecting
ringing etc. various states and events are shown in figure below.
Idle
pickup on-hook
timeout
Recorded
digit(n) Dialing invalid Message
Fast Busy
Tone
Ringing
Connected
Disconnected
Figure 3.21
3.3 Summary
• The state diagram should adhere to OMT's notation and exploit the
capabilities of OMT, such as transition guards, actions and activities, nesting
(state and event generalization), and concurrency.
Chapter 4
Functional Modeling
Structure
4.0 Introduction
4.1 Objectives
4.2 Presentation of Contents
4.2.1 Functional Modeling
4.2.1.1 Data Flow Diagram (DFD)
4.2.1.1.1 External Entity
4.2.1.1.2 Process
4.2.1.1.3 Data Store
4.2.1.1.4 Data Flow
4.2.1.2 Control Flow
4.2.1.3 Examples of DFDs
4.2.2 Data Dictionary & Meta Data
4.2.3 Steps to Produce a DFD
4.2.4 Different Types of Keys
4.3 Summary
4.4 Suggested Readings/Reference Materials
4.5 Self-Assessment Questions
1
4.0 Introduction
The functional model describes computations and specifies those aspects of the
system concerned with transformations of values - functions, mappings, constraints,
and functional dependencies. The functional model captures what the system does,
without regard to how or when it is done.
The functional model uses a hierarchy of data flow diagrams (DFDs) in a similar
fashion to the Yourdon method. However, the DFDs are not very well integrated with
the object and dynamic models and it is difficult to imagine many projects making
extensive use of the functional model.
Some aspects of the functional model are, however, quite useful. For example, the
context diagram is vital for defining the scope of the system. Also, it may be possible
to strengthen the real-time aspects of the method by introducing the concept of a
processor and task model using DFDs.
Data Flow Diagrams are commonly used during problem analysis. They are quite
general and are not limited to problem analysis for software requirements
specification. DFDs are very useful in understanding a system and can be effectively
used during analysis.
4.1 Objectives
In this chapter, you will learn what is functional model and DFDs. The chapter
discusses how to draw a DFD, what is data dictionary and metadata. It also
introduces concepts of candidate keys.
The functional model describes computations and specifies those aspects of the
system concerned with transformations of values - functions, mappings, constraints,
and functional dependencies. The functional model captures what the system does,
without regard to how or when it is done.
2
The functional model is represented graphically with multiple data flow diagrams,
which show the flow of values from external inputs, through operations and internal
data stores, to external outputs. Data flow diagrams show the dependencies
between values and the computation of output values from input values and
functions. Functions are invoked as actions in the dynamic model and are shown as
operations on objects in the object model. The data flow diagram should adhere to
OMT's notation and exploit the capabilities of OMT, such as nesting, control flows,
and constraints.
Data Flow Diagrams are commonly used during problem analysis. They are quite
general and are not limited to problem analysis for software requirements
specification. DFDs are very useful in understanding a system and can be effectively
used during analysis.
A DFD shows the flow of data through a system. It views a system as a function that
transforms the inputs into desired outputs. Any complex system will not perform this
transformation in a "single step", and a data will typically undergo a series of
transformations before it becomes the output. The DFD aims to capture the
transformations that take place within a system to the input data so that eventually
the output data is produced. The agent that performs the transformation of data from
one state to another is called a process. So a DFD shows the movement of data
through the different transformation or process in the system.
DFDs are basically of 2 types: Physical and logical ones. Physical DFDs are used in
the analysis phase to study the functioning of the current system. Logical DFDs are
used in the design phase for depicting the flow of data in a proposed system.
In a nutshell, a data flow diagram is a graph showing the flow of data values from
their sources in objects through processes that transform them to their destinations
in other objects.
3
Data Flow Diagrams are composed of the four basic symbols – external entities,
processes, data stores and data flow - as discussed below.
Any system can be represented at any level of detail by these four symbols. Now,
these four elements of DFD are discussed in detail.
The External Entity symbol represents sources of data to the system or destinations
of data from the system. They determine the system boundary. They are external to
the system being studied. They are often beyond the area of influence of the
developer. They can represent another system or subsystem. These go on
margins/edges of data flow diagram. They are represented by a rectangle symbol
and are named with appropriate name as shown in Fig below.
Some authors call them actors as they are active objects that drive the data flow
diagram by producing or consuming values. Actors are attached to the inputs and
outputs of a data flow diagram. Actors are also called as terminators as they act as
source and sink for data.
4.2.1.1.2 Process
4
process must be "worked on" or transformed in some way. Thus, all processes must
have inputs and outputs. In some cases, data inputs or outputs will only be shown at
more detailed levels of the diagrams. Each process is always "running" and ready to
accept data. Major functions of processes are computations and making decisions.
Each process may have dramatically different timing: yearly, weekly, daily etc.
Every process is named. Processes are named with one carefully chosen verb and
an object of the verb. There is no subject. Name is not to include the word "process".
Each process should represent one function or action. If there is an "and" in the
name, you likely have more than one function (and process). For example, get
invoice, update customer and create Order. Processes are numbered within the
diagram as convenient. Levels of detail are shown by decimal notation. For example,
top level process would be Process 4, next level of detail Processes 4.1, and so on.
Processes should generally move from top to bottom and left to right.
Data stores are repository for data that are temporarily or permanently recorded
within the system. It is an "inventory" of data. These are common link between data
and process models. Only processes may connect with data stores.
There can be two or more systems that share a data store. This can occur in the
case of one system updating the data store, while the other system only accesses
the data. Data stores are represented by open rectangle or two parallel lines as
shown below.
or
5
Data stores are named with an appropriate name, not to include the word "file",
Names should consist of plural nouns describing the collection of data. Like
customers, orders, and products. These may be duplicated.
They store data for later use. They do not generate any operation on its own but can
respond to request. That is why they are passive objects in a data flow diagram.
Data flow represents the input (or output) of data to (or from) a process, data store or
an actor. Data flow only data, not control. Represent the minimum essential data the
process needs. Using only the minimum essential data reduces the dependence
between processes. Data flows must begin and/or end at a process.
Data flows are always named. Name is not to include the word "data". It should be
given unique names. Names should be some identifying noun. For example, marks,
order, payment, complaint, registration no.
An arrow between the producer and the consumer of the data value represents a
data flow. Arrow is labeled with description of data. Data can be elementary or
aggregate. Input arrow indicates storing data in the data store and output arrow
indicates accessing of data from data store.
Elementary data can not be decomposed into its meaningful constituents. For
example, roll no, pin code, and quantity. Aggregate data can be decomposed into its
meaningful constituents. For example, name can be decomposed into first name,
middle name and last name. Sometimes an aggregate value is split into its
constituents, each of which goes to a different process. A fork in the path as shown
below is used to do this. Reverse can also be done. That is elementary data coming
6
from different sources can be aggregated. This is done by reversing the arrows in
the diagram below.
Street
Address city
State
Control flow is a Boolean value in the DFD that affects whether a process is
evaluated or not. The control flow is not an input value to the process. It is
represented by a dotted line from a process originating the Boolean value to the
process being controlled as shown in fig below. This DFD is for a withdrawal from a
bank account. The customer supplies a password and an amount. The update
(withdrawal) can occur only when password is OK, which is shown as control flow in
the diagram.
Amount
Customer Update
Cash
7
4.2.3 Examples of DFDs
Example1: An example of a Data Flow Diagram - DFD for a system that pays
workers is shown in the figure below. In this DFD there is one basic input data flow,
the weekly time sheet, which originates from the source worker. The basic output is
the pay check, the sink for which is also the worker. In this system, first the
employee's record is retrieved, using the employee ID, which is contained in the time
sheet. From the employee record, the rate of payment and overtime are obtained.
These rates and the regular and overtime hours (from the time sheet) are used to
complete the payment. After total payment is determined, taxes are deducted. To
computer the tax deduction, information from the tax rate file is used. The amount of
tax deducted is recorded in the employee and company records. Finally, the
8
paycheck is issued for the net pay. The amount paid is also recorded in company
records.
Following are the set of DFDs drawn for the General model of publisher's present
ordering system.
9
Third Level DFD - Elaborating an order processing & shipping
10
From the level one it shows the publisher's present ordering system. Let's expand
process order to elaborate on the logical functions of the system. First, incoming
orders are checked for correct book titles, author's names, and other information and
then batched into other book orders from the same bookstore to determine how may
copies can be shipped through the ware house. Also, the credit status of each book
stores is checked before shipment is authorized. Each shipment has a shipping
notice detailing the kind and numbers of booked shipped. This is compared to the
original order received (by mail or phone) to ascertain its accuracy. The details of the
order are normally available in a special file or data store, called "Bookstore Orders".
It is shown in the second level DFD diagram.
Following the order verification and credit check, a clerk batches the order by
assembling all the book titles ordered by the bookstore. The batched order is sent to
the warehouse with authorization to pack and ship the books to the customer. It is
shown in the third level DFD diagram.
Further expansion of the DFD focuses on the steps in billing the bookstore shown in
the fourth level DFD, additional functions related to accounts receivable.
name
Customer
Request Balance
Update
11
Example 4: DFD below shows the purchase order processing system. There are four
actors involved in this system – Purchasing Officer, Vendor, Purchaser 1 and
Purchaser 2. Purchasing Officer creates purchase orders on receiving the purchase
acquisition requests from the perspective purchasers. Purchasers approve orders
and they can verify the status of the orders. All order details are kept in a database.
12
4.2.2 Data Dictionary and Meta Data
In the data flow diagrams, we have given names to data flows, processes and data
stores. Although the names are descriptive of the data, they do not give details. So
following the DFD, the interest is to build some structures place to keep details of the
contents of data flows, processes and data stores. Here comes the concept of data
dictionary.
13
The data dictionary for the DFD of system that pays to workers given above is
created as shown below:
Most of the data flows in the DFD are specified here. Some of the most obvious ones
are not shown here. The data dictionary entry for weekly timesheet specifies that this
data flow is composed of three basic data entities - the employee name, employee
ID and many occurrences of the two - tuple consisting of regular hours and overtime
hours. The last entity represents the daily working hours of the worker. The data
dictionary also contains entries for specifying the different elements of a data flow.
Once we have constructed a DFD and its associated data dictionary, we have to
somehow verify that they are "correct". There can be no formal verification of a DFD,
because what the DFD is modeling is not formally specify anywhere against which
verification can be done. Human processes and rule of thumb must be used for
verification. In addition to the walkthrough with the client, the analyst should look for
common errors. Some common errors are
The DFDs should be carefully scrutinized to make sure that all the processes in the
physical environment are shown in the DFD. It should also be ensured that none of
the data flows is actually carrying control information.
14
Meta Data: It is loosely defined as data about data. Metadata is a concept that
applies mainly to electronically archived or presented data and is used to describe
the: a) definition, b) structure and c) administration of data files with
all contents in context to ease the use of the captured and archived data for further
use. For example, a web page may include metadata specifying what language it's
written in, what tools were used to create it, where to go for more on the subject and
so on.
Metadata is defined as data providing information about one or more other pieces of
data, such as:
means of creation
purpose of the data
time and date of creation
creator or author of data
placement on a network (electronic form) where the data was created,
What standards used etc.
For example: A digital image may include metadata that describes how large the
picture is, the color depth, the image resolution, when the image was created, and
other data. A text document's metadata may contain information about how long the
document is, who the author is, when the document was written, and a short
summary of the document.
15
Element name Value
Identifier www.gju.ac.in.metadata.html
Format Text/html
16
Descriptive metadata: It describes a resource for purposes such as discovery and
identification. It can include elements such as title, abstract, author, and keywords.
Structural metadata: It indicates how compound objects are put together, for
example, how pages are ordered to form chapters.
Administrative metadata: It provides information to help manage a resource, such as
when and how it was created, file type and other technical information, and who can
access it.
• Identify and list external entities providing inputs/receiving outputs from system
• Identify and list inputs from/outputs to external entities
• Draw a context DFD
Defines the scope and boundary for the system and project
ii. Only show those data flows that represent the main objective or most
common inputs/outputs
17
- Shows the major subsystems and how they interact with one another
- Exploding processes should add detail while retaining the essence of the
details from the more general diagram
- Must show all appropriate primitive data stores and data flows
Balancing DFDs
• Balancing: child diagrams must maintain a balance in data content with their
parent processes
• Can be achieved by either:
• exactly the same data flows of the parent process enter and leave the child
diagram, or
• the same net contents from the parent process serve as the initial inputs and
final outputs for the child diagram or
• the data in the parent diagram is split in the child diagram
• A process must have at least one input and one output data flow
18
• A process begins to perform its tasks as soon as it receives the necessary
input data flows
• A primitive process performs a single well-defined function
• Never label a process with an IF-THEN statement
• Never show time dependency directly on a DFD
• Be sure that data stores, data flows, data processes have descriptive titles.
Processes should use imperative verbs to project action.
• All processes receive and generate at least one data flow.
• Begin/end data flows with a bubble.
19
• Think of data flow not control flow. Data flows are pathways for data. Think
about what data is needed to perform a process or update a data store. A
data flow diagram is not a flowchart and should not have loops or transfer of
control. Think about the data flows, data processes, and data storage that are
needed to move a data structure through a system.
• Do not try to put everything you know on the data flow diagram. The diagram
should serve as index and outline. The index/outline will be "fleshed out" in
the data dictionary, data structure diagrams, and procedure specification
techniques.
Primary key: Within a given relation, there can be one attribute with values that are
unique within the relation that can be used to identify the tuples of that relation. That
attribute is said to be primary key for that relation. For example, in a Student relation
roll no is a primary key.
Composite primary key: Not every relation will have a single-attribute primary key.
There can be a possibility that some combination of attributes when taken together
have the unique identification property. These attributes as a group is called
composite primary key. A combination consisting of a single attribute is a special
case.
20
• In practice it is not usually necessary to involve all the attributes-some lesser
combination is normally sufficient. Thus, every relation does have a primary
(possibly composite) key.
• Tuples represent entities in the real world. Primary key serves as a unique
identifier for those entities.
Candidate key: In a relation, there can be more than one attribute combination
possessing the unique identification property. These combinations, which can act as
primary key, are called candidate keys.
Alternate key: A candidate key that is not a primary key is called an alternate key. In
fig. 8.6 if EmpNo is primary key then SocSecurityNo is the alternate key.
4.3 Summary
21
• Metadata is structured information that describes, explains, locates, or
otherwise makes it easier to retrieve, use, or manage an information resource.
Metadata is often called data about data or information about information.
• Within a given relation, there can be one attribute with values that are unique
within the relation that can be used to identify the tuples of that relation. That
attribute is said to be primary key for that relation.
22
23
Writer: Dr. Rajender Nath
Vetter: Dr. Dharminder Kumar
Chapter 5
System Design
Structure
5.0 Introduction
5.1 Objectives
5.2 Presentation of Contents
5.2.1 System Design
5.2.1.1 Estimating System Performance
5.2.1.2 Making a Reuse Plan
5.2.1.3 Organizing a system into Subsystems
5.2.1.4 Identifying Concurrency
5.2.1.5 Allocation of Subsystems
5.2.1.6 Estimating Hardware resource Requirements
5.2.1.7 Making Hardware-Software Trade-offs
5.2.1.8 Allocating Tasks to Processors
5.2.1.9 Determining Physical Connectivity
5.2.1.10 Management of Data Storage
5.2.1.11 Handling Global Resources
5.2.1.12 Choosing a Software Control Strategy
5.2.1.13 Handling boundary Conditions
5.2.1.14 Setting trade-off Priorities
5.2.2 Common Architectural Styles
5.3 Summary
5.4 Suggested Readings/Reference Materials
5.5 Self-Assessment Questions
1 1
5.0 Introduction
After analyzing the problem, one must decide how to approach the system
design. During system design developers devise the high-level strategy (system
architecture) for solving the problem and building a solution and make decisions
about the organization of the system into subsystems, the allocation of
subsystems to hardware and software and major policy decisions that form the
basis for class design.
5.1 Objectives
In this chapter you will learn what is system design? What is physical and logical
design? What are different types of design decisions made by the designer?
What is software architecture? What are different types of architectural styles?
2 2
The physical design relates to the actual input and output processes of the
system. This is laid down in terms of how data is input into a system, how it is
verified/authenticated, how it is processed, and how it is displayed as output.
Physical design, in this context, does not refer to the tangible physical design of
an information system. To use an analogy, a personal computer's physical
design involves input via a keyboard, processing within the CPU, and output via
a monitor, printer, etc. It would not concern the actual layout of the tangible
hardware, which for a PC would be a monitor, CPU, motherboard, hard drive,
modems, video/graphics cards, USB slots, etc.
In the OMT methodology, system design is one of the phases of the software
development life cycle. During this phase, developers decide the overall structure
and style of the system. The system architecture determines the organization of
the system into subsystems. During system design, the following design
decisions are to be made.
3 3
5.2.1.1 Estimating System Performance
For example, the .NET Framework class library is a library of classes, interfaces,
and value types that are included in the Microsoft .NET Framework SDK. This
4 4
library provides access to system functionality and is designed to be the
foundation on which .NET Framework applications, components, and controls
are built.
• Coherence
• Completeness
• Consistency
• Efficiency
• Extensibility
• Genericity
Many problems may arise when classes are reused from many sources. Such
problems are sometime very difficult to solve by specializing a class and adding
codes. These problems effectively limit the reuse of classes from the class
libraries. The following types of problems may be encountered in reusing class
libraries.
5 5
Control paradigms: Different class libraries may us different control paradigms.
For example, one library uses procedure-driven control and another uses event-
driven control. Combining these two types of control into one application is
difficult and awkward.
Group operations: If you want to delete objects in groups then that library must
have group-delete function. If that function is not available then you can not
reuse the classes of that library. Group operations are often inefficient and
incomplete.
Name collisions: classes from different libraries may have same name for public
identifiers causing names collisions. To resolve this problem, most of the class
libraries add a distinguishing prefix to names to reduce the chance of names
collision.
6 6
Frameworks are a special case of software libraries in that they are reusable
abstractions of code wrapped in a well-defined Application Programming
Interface (API), yet they contain some key distinguishing features that separate
them from normal libraries. Software frameworks typically contain considerable
housekeeping and utility code in order to facilitate user applications, but generally
focus on specific problem domains.
Following are some of the problem domains where frameworks have been used:
• Artistic drawing, music composition, and mechanical
• Compilers for different programming languages and target machines
• Financial modeling applications
• Earth system modeling applications
• Decision support systems
• Media playback and authoring
• Web applications
• Middleware
7 7
In an object-oriented environment, a framework consists of abstract and
concrete classes. Instantiation of such a framework consists of composing and
subclassing the existing classes. When developing software based on
framework reuse, the new system is built by customizing and/or extending the
generic architecture defined by the framework.
Software frameworks have these distinguishing features that separate them from
libraries or normal user applications:
8 8
b) Pattern based Reuse
9 9
Examples of creational patterns are: Abstract Factory – it provides an interface
for creating families of related or dependent objects without specifying their
concrete classes. Builder Pattern – it separates the construction of a complex
object from its representation allowing the same construction process to create
various representations.
For instance, when someone checks their bank account from a computer, the
computer acts as the client and forwards the request to an on-line bank (server).
The bank’s program (server) then serves a response to the user in which the
10 10
requested information is displayed. The client/server model has become a
predominate function in network computing. Many applications intended for both
personal and business use were designed with this concept in mind. In most
cases, both the client and server are part of a larger program or system. As it
relates to the Internet, a web browser acts as a client that requests specific
services to a web server, a process known as HTTP (Hypertext Transfer
Protocol). In similar fashion, a computer that relies on TCP/IP for a connection
enables a user to make client requests to FTP servers found in other computers
connected to the Internet.
Layers: A layered system is an ordered set of virtual worlds, each built in terms
of the ones below it and providing the implementation basis for the ones above it.
Layered architecture comes in closed or open.
In a closed architecture, each layer is built only in terms of the immediate lower
layer. This reduces dependencies between layers and allows changes to be
made most easily. In an open architecture, a layer can use the features of any
lower layer to any depth. This reduces the need to redefine operations at each
level.
11 11
layered system architecture is the ISO Reference Model for Open Systems
Interconnection (OSI) as shown in Figure below.
Application
Presentation
Session
Transport
Network
Data Link
Physical
12 12
executable file is loaded into memory for execution, the file system, the memory
management system, and the process control system all interoperate.
Hardware Control
13 13
5.2.1.4 Identifying Concurrency
14 14
decomposing the system into distributed subsystems and defining the
message communication interfaces between the subsystems.
• Make decisions about class interfaces. For each subsystem, design the
information hiding classes (passive classes). Design the operations of
each class and the parameters of each operation. Use inheritance to
develop class hierarchies. Develop the detailed software design,
addressing detailed issues concerning task synchronization and
communication, and the internal design of concurrent tasks.
15 15
• Allocate software subsystems to processors to satisfy performance needs
and minimize inter processor communication
• Determine the connectivity of the physical units that implement the
subsystems.
• Consider the connection between nodes and communication protocols to
be used.
• Consider the need for redundant processing.
• Identify any interface implied by deployment.
16 16
• Performance: Dedicated hardware gives high performance than the same
task carried using software instructions. For example chips that perform
Fourier transformation are widely used in signal-processing applications.
The system designer must allocate the tasks for various subsystems to
processors. Each concurrent subsystem should be allocated to an independent
process or processor. The system designer must do the following:
System designer must decide the arrangement and form of connections among
various units. The following decisions must be made.
17 17
• Connection Topology: Topology refers to the type of arrangements for
physical units. The topology must be chosen keeping in mind the no. of
physical units and to minimize the cost of communications.
System designer must decide from among several alternatives for data storage
that can be used separately or in combination of data structures, files and
databases. This involves identifying the complexity of the data, the size of the
data, the type of access to data (single user or multiple user), access times and
portability. Having considered these issues, the designer must make the decision
about whether he data can be held in flat files or in relational or object databases.
18 18
• Purchase cost: If your system requires a database system then it is likely that
this will increase the cost of the system. It may also involve licensing
agreements.
• Life cycle cost: This reflects costs such as purchase, development,
deployment, operating and maintenance costs.
• Amount of data: The more data the designer has the more carefully he needs
to think about how it should be stored and accessed.
• Performance: In main memory, the storage provides the faster data access
while files are likely to provide the poorest performance.
• Extensibility: How easy it will be to extend your application in the future for a
given the method of data storage.
• Concurrent access: Whether the designer needs concurrent access or not.
• Crash recovery: How will you recover your data if the system crashes.
• Distribution: Will the data need to be distributed among a number of sites? If
yes, then make the decision accordingly.
Different kinds of data stores provide trade-offs among cost, access time,
capacity and reliability.
Files provide cheap, simple and permanent storage and are easy to work with.
However, file on one system may not be useful when transported to another
system because of varying file implementations over different hardware types.
Files may be used in random access mode or sequential access mode.
Sequential file format is mostly a standard format and is easy to handle.
Whereas, the commands and storage formats for random access files and index
files vary in their formats.
• Data with high volumes and low information density (such as archival files
or historical data)
19 19
• Modest quantities of data with simple structure.
• Data that are accessed sequentially.
• Data that can be fully read into the memory.
The system designer must identify global resources and determine mechanisms
for controlling access to them. There are several kinds of global resources:
Physical resource such as processors, tape drives etc. can control their own
access by establishing a protocol for obtaining access. For a logical resource like
20 20
Object ID or a database, there arises a need to provide access in a shared
environment without any conflicts. One strategy to avoid conflict may be to
employ a guardian object which controls access to all other resources. Any
request to access a resource has to pass through a guardian object only.
Another strategy may be to partition a resource logically and assign subsets to
different guardian objects for independent control. In a critical real time
application passing the entire access requests or resources through a guardian
object may be not be desirable and it may become necessary to provide direct
access to resources. In this case, to avoid conflicts, a lock can be placed on the
subsets of resources. A lock is a logical object associated with a shared resource
which gives the right of accessing the resource to the lock holder. Guardian
object can still exist to allocate the lock. However, direct access to resources
must not be implemented unless it is absolutely desirable.
It is best to choose a single control style for the whole system. There are two
kinds of control flows in a software system: External control and internal control.
External control concerns the flow of externally visible events among the objects
in the system. There are three kinds of external events: procedural-driven
sequential, event-driven sequential and concurrent.
21 21
Event-driven Control: In the sequential model, the control resides within a
dispatcher or monitor that the language, subsystem or operating system
provides. In event-driven, the developers attach application procedures to events
and the dispatcher calls the procedures when the corresponding events occur.
Usually event driven systems are used for external control in preference to
procedure driven systems, because the mapping from events to program
constructs is simpler and more powerful. Event driven systems are more modular
and can handle error conditions better than procedure-driven systems.
For example, the GUI consists of many built in objects (like text boxes, tool icons
menus etc). The user interacts with these GUI objects either through mouse
clicks or through pressing keys on keyboard. These user interactions with GUI
objects are called events and these event notifications are given to the program
(whom the user is interacting with) by Windows operating system. Now the
programmer's task is to write the code that executes on the occurrence of these
events automatically, and this type of control is called event-driven control.
Internal control refers to the flow of control within a process. It exists only in the
implementation and therefore is neither inherently concurrent nor sequential.
22 22
• Initialization: It refers to initialization of constant data, parameters, global
variables, tasks, guardian objects, and classes as per their hierarchy.
Initialization of a system containing concurrent tasks must be done in a
manner so that tasks can be started without prolonged delays. There is quite
possibility that one object has been initialized at an early stage and the other
object on which it is dependent is not initialized even after considerable time.
This may lead to halting of system tasks.
The system designer must set priorities that will be used to guide trade-offs for
the rest of the design. For example system can be made faster using extra
memory. Design trade-offs involve not only the software itself but also the
process of developing it. System designer must determine the relative
importance of the various criteria as a guide to making design trade-offs. Design
trade-offs affect entire character of the system. Setting trade-offs priorities is at
best vague. Priorities are generally specified as a statement of design
philosophy.
23 23
5.2.2 Common Architectural Styles
• Break the overall transformation into stages, with each stage performing one
part of the transformation.
24 24
• Prepare class models for the input, output and between each pair of
successive stages. Each state knows only about the models on either side of
it.
In this system input is to the first phase and output is from the last phase. Input
will be the source program and output will be the object program.
25 25
A data transformation performed continuously as inputs change. It is a system in
which the outputs actively depend on changing inputs. It updates outputs
frequently. One way to implement continuous transformation is with a pipeline of
functions. Through the pipeline any change in input is propagated. Examples of
continuous transformation applications are windowing systems, signal
processing, process monitoring systems, incremental compilers etc.
• Break the overall transformation into stages performing one part of the
transformation.
• Define input, output and intermediate models between each pair of
successive stages, as for the batch transformation.
• Differentiate each operation to obtain incremental changes to each stage.
That is, propagate the incremental effects of each change to an input through
the pipeline as a series of incremental updates.
• Add additional intermediate objects for optimization.
26 26
It is a system dominated by interactions between the system and external agents
called actors. An actor can be a person, a device or another system/subsystem.
The actors are not the part of the system rather they are supposed to lie on the
boundary of the system. The main concerns of interactive interface are the
communication protocols between the system and the actors, the flopw of control
within the system, performance, error handling etc.
Dynamic simulation is the use of a computer program to model the time varying
behavior of a system. It models real-world objects. In this objects and operations
directly come from the application and hence it is easy to implement. Controls
can be implemented in two ways in dynamic simulation systems – external
control and internal control. In former, objects simulate a state machine and in
later objects can exchange messages among themselves. Examples of dynamic
simulation are video games, spacecraft trajectory computation system, moleculer
motion mode etc.
27 27
• Identify active real word objects from the class model. These objects have
attributes that are periodically updated.
• Identify a discrete event, which corresponds to discrete interactions with the
object.
• Identify continuous dependencies. Real world attributes may be dependent on
other real-world attribute.
• Generally a simulation driven by a timing loop at a fine time scale. Discrete
events between objects can often be exchanged as part of the timing loop.
28 28
5.2.2.6 Transaction Manager
5.3 Summary
29 29
• The physical design relates to the actual input and output processes of the
system. This is laid down in terms of how data is input into a system, how it is
verified/authenticated, how it is processed, and how it is displayed as output.
• It is much easier to use existing things than to design new things for uncertain
use to come. Reusable things include models, libraries, frameworks and
patterns.
• A subsystem may be defined as a group of classes, associations, operations,
events and constraints that are interrelated and have a well-defined interface.
• In a layered architecture model, classes within each subsystem layer provide
services to the layer above it. Ideally, this knowledge is one-way: each layer
knows about the layer below it, but the converse is not true
• Partitions vertically divide a system into several independent or weakly
subsystems, each providing one kind of service.
• To increase the performance of system, multiple processors or hardware
functional units may be used. The number of processors required depends on
the volume of computations and the speed of the machine
• The system designer must allocate the tasks for various subsystems to
processors. Each concurrent subsystem should be allocated to an
independent process or processor.
• System designer must decide from among several alternatives for data
storage that can be used separately or in combination of data structures, files
and databases.
• The system designer must identify global resources and determine
mechanisms for controlling access to them
• There are two kinds of control flows in a software system: External control
and internal control. External control concerns the flow of externally visible
events among the objects in the system. There are three kinds of external
events: procedural-driven sequential, event-driven sequential and concurrent.
• Although most of the system design concerns steady-state behavior system
designer must consider boundary conditions as well and address issues like
initialization, termination and failure.
30 30
• The architecture of a system describes its gross structure. This structure
illuminates the top-level design decisions, including things such as how the
system is composed of interacting parts, where are the main pathways of
interaction, and what are the key properties of the parts.
1. What is system design? What are two types of system design? Explain.
2. What are different types of design decisions taken by a system designer?
Explain in detail.
3. What is reuse plan? Discuss three models for reusability.
4. What is library-based reuse? Discuss problems faced in library-based reuse.
5. What is framework based reuse? How is it different from pattern?
6. What is pattern based reuse? Explain.
7. What is subsystem? What are different types of relationships between
subsystems? Explain.
8. What are partitions and layers in a system?
9. How can you identify subsystems?
10. How do you identify concurrency?
11. How do you decide allocation of subsystems to processors?
31 31
12. How do you estimate hardware resource requirements?
13. How do you allocate tasks to processors?
14. How do you determine physical connectivity among subsystems?
15. Write a short note on data storage management.
16. Discuss the suitability of different types of data storages.
17. What are global resources in a system? How can you handle them?
18. How do you choose a software control strategy? Explain.
19. Distinguish between procedure driven and event driven control.
20. Distinguish between external and internal control.
21. What are boundary conditions? How do you handle them?
22. How do you set trade-off priorities?
23. What is software architecture? Discuss some commonly used architectural
styles.
24. What is batch transformation architectural style? Enumerate the steps to be
followed for this style.
25. What is continuous transformation architectural style? Enumerate the steps to
be followed for this style.
26. What is interactive interface architectural style? Enumerate the steps to be
followed for this style.
27. What is dynamic simulation architectural style? Enumerate the steps to be
followed for this style.
28. What is transaction manager architectural style? Enumerate the steps to be
followed for this style.
29. What is real time system?
32 32
Writer: Dr. Rajender Nath
Vetter: Dr. Dharminder Kumar
Chapter 6
Object Design
Structure
6.0 Introduction
6.1 Objectives
6.2 Presentation of Contents
6.2.1 Object Design
6.2.1.1 Combine Three Models To Get Operations Of Classes
6.2.1.2 Design Algorithms For Operations
6.2.1.3 Optimize The Design
6.2.1.4 Implementation of Control
6.2.1.5 Maximize Inheritance
6.2.1.6 Design Associations
6.2.1.7 Determine Object Representation
6.2.1.8 Packaging of Classes and Associations into Modules
6.2.2 Documentation
6.2.3 Implementation Using A Programming Language
6.2.4 Implementation Using A Database System
6.3 Summary
6.4 Suggested Readings/Reference Materials
6.5 Self-Assessment Questions
1
6.0 Introduction
The object design is the next phase in the OMT methodology. Object oriented
design is a process of refinement or adding details. The object-designer works to
implement the objects discovered during analysis phase. All the operations identified
during analysis are expressed as algorithms, with complex operations expressed as
internal operations. The classes, attributes and associations from analysis must be
implemented as specific data structures. New object classes may be introduced to
store intermediate results in this phase. The following steps are performed in the
object design phase:
6.1 Objectives
After having discussed high-level design decisions made during the system design
phase as has been discussed in the last chapter, in this chapter you will learn how to
combine three models developed during analysis phase to obtain operations on
objects. How can you design and optimize algorithms? How can you implement
software controls? The way you can maximize inheritance tree. How can you
implement associations and represent objects? Packaging of classes and
association will be discussed in this chapter. Documentation and implementation of
design will also be discussed in this chapter.
2
6.2 Presentation of Contents
6.2.1 Object Design
The outcomes of the analysis phase are three models – object model, dynamic
model and functional model. Operations for the classes may not be specified in the
object model. These operations are obtained from dynamic and functional model.
The object designer has convert actions and activities of the dynamic model and
processes of the functional model into operations of the classes in the object model.
Each state diagram constructed in the dynamic model gives the life history of an
object. A transition in the state diagram represents a change of state of the object,
which can be mapped into an operation on the object. One operation can be
associated with an each event received by an object. The action performed by a
transition depends on both the event and the state of the object. This implies that the
algorithm implementing an operation depends upon the state of the object.
An action or activity initiated by a transition in a state diagram may expand into a full-
fledged DFD in the functional model. The collection of processes within the DFD
represents the body of an operation. The data flows in the DFD show intermediate
values in the operation. The object designer must convert the graph structure of the
DFD into a linear sequence of steps in an algorithm. The processes in the DFD
constitute suboperations. These may be on the original target object or on other
objects.
3
The target objects of a suboperation can be determined as follows:
• If a process extracts a value from an input flow then the output flow is the
target.
• If a process takes an output value from several input flows, then the
operation is a class operation on the output class.
• If a process has an input flow and an output flow of the same type and the
output value is considerably modified version of the input flow then
input/output flow is the target.
• If a process has an input from or output to a data store or an actor then
the data store or an actor is the target of the process.
An algorithm is designed for each operation specified in the DFD. The DFD tells
what the operation does but the algorithm tells how it is done. The data store or an
actor is the target of the process.
The algorithm designer must follow the following steps for designing algorithms for
operations:
Choose an appropriate data structure: Every algorithm uses some data structures
such as strings, array, lists, queues, stacks, trees, graphs, sets, bags etc. To make
an algorithm efficient, an appropriate data structure should be chosen. For example,
stack can be implemented by using an array or by using a linked list. The algorithm
designer has to choose an appropriate data structure.
If one object is acted upon while the other object performs the action then associate
the operation with the target of the operation.
If one object is modified by the operation while other objects are read only assign the
operation with the object, which is modified, by the operation.
5
If the classes and associations form a star network then assign the operation to the
central class.
The analysis model captures the logical information about the system, while the
design model must add details to support efficient information accesses. The
designer must strike the balance between efficiency and clarity.
For this example, suppose that company has 1000 employees each of whom has 10
skills on an average. To know about how many employees speak French, a simple
nested loop will traverse employees 1000 times and has-skill 10,000 times. In cases
where number of hits from a query is low because only a fraction of objects satisfy
the test, we can add a qualified association - speaks language - from company to
employee, where qualifier is the language spoken as shown in Figure below. This
permits us to find all employees who speak a particular language with no wasted
accesses.
6
Employs
Company Person Has-Skill Skill
Speaks language
Company
Language Person
Rearranging Execution Order for Efficiency: After adjusting the structure of the
object model for optimization the next thing to optimize is the algorithm itself. There
may exist certain paths, which may be termed as dead path that means that
chances of execution along those paths are very less.
Saving Derived Attributes to Avoid Recomputation: There may exist some data
which can be derived from other data. This kind of data may be termed as redundant
data and it can be cached or stored in its computed form to avoid overhead of
recomputing again. The class that contains redundant data must be updated if any
of the objects that it depends upon are changed.
7
Attribute
Location {Ordered}
Operation
Text
Attribute
Attribute {Ordered}
text/location
list
Class
Box region
Operation Operation
Location {Ordered}
list
region text/location
Figure above shows a use of derived object and the derived attribute. Each class
box contains an ordered list of attributes and operations, each represented as a text
string. Given the location of class box itself, the location of each attribute can be
computed by adding up the size of all the elements in front of it. Since the location of
each element is needed frequently, the location of each attribute string is computed
and stored. The region containing the entire attribute list is also computed and
stored so that input points need not be tested against attribute text elements in other
boxes. Derived attributes must be updated when base values change. There are
three ways to recognize when an update is needed: by explicit code, by periodic
recomputation, or by using active values.
8
Explicit Update: Each derived attribute is defined in terms of one or more
fundamental base objects. The designer determines which derived attributes are
affected by each change to a fundamental attribute and inserts code into update
operation on the base object to explicitly update the derived attributes that depend
on it.
Active Values: An active value is a value that has dependent values. An operation
to update the base value triggers update of all the dependent values.
As part of the system design, the designer must implement state diagram of the
dynamic model. There are three basic approaches to implement it:
State as location within a program: The location of control within a program can
be used to represent state of the program. Each state transition corresponds to an
input statement. The control of the program branches depending upon the input
event received. In highly nested procedural code, there must be a procedure, which
can handle the supplied input.
9
1. Identify the main path through the diagram that leads to normal execution of
events. Identify the names of states along this path. This becomes a
sequence of statements in the program.
2. Identify alternate paths, which branch off the main path. This becomes the
conditional statements in the program.
3. To identify the loops, find out backward paths that branch off the main path.
Multiple backward paths become nested loops in the programs.
4. Remaining states and conditions correspond to exceptional conditions. These
exceptional conditions can be handled through exception handling or
including error subroutines.
10
generalizes what is common between dogs and cats, and dogs and cats specialize
mammals to their own specific subtypes. These relationships are hierarchical
because they create a relationship tree, with specialized types branching off from
more generalized types. As you move "up" the hierarchy, you achieve greater
generalization. You move up toward Mammal to generalize that dogs, cats, and
horses all bear live young, nurses with milk, have hair. As you move "down" the
hierarchy you specialize. Thus, the cat specializes Mammal in having claws (a
characteristic) and purring (a behavior).
Similarly, when you say that ListBox and Button are Windows, you indicate that
there are characteristics and behaviors of Windows that you expect to find in both of
these types. In other words, Window generalizes the shared characteristics of both
ListBox and Button, while each specializes its own particular characteristics and
behaviors.
The definition of classes and operations can be adjusted to make the inheritance
tree as large as possible. It can be done in the following ways.
11
• Some operations may have fewer arguments than others. The missing
arguments can be supplied in the function definition and they may be ignored.
• Similar attributes in different classes may have the different names. These
attributes may be moved to a common ancestor class.
• Some operations may have fewer arguments because they are special cases
of more general arguments. These special operations can be implemented by
calling the general operations with appropriate parameters
• An operation may be defined on several different classes in a group but may
not be required in other classes. In that case the operation can be defined as
a common ancestor class and can be declared as no-operation on the
classes that don’t care about it.
During the design phase, new classes and operations are often added which
generally may lead to commonality between classes. In this case, a common super
class can be created that implements the shared features of the classes. The
subclasses may be derived from super class and may implement their own
specialized features. Usually the resulting super class is an abstract class, meaning
that there are no direct instances of it, but all its operations can be defined and
implemented by subclasses. This leads to reusability of the code.
Sometimes there may be only one subclass, even in that case it is advisable to
abstract out a super class. It is quite possible that new subclasses may be added
during project development life cycle or in future the scope of the project may be
increased. The splitting of a class into two classes that separate the specific aspects
from the more general aspects is a form of modularity. The creation of abstract
super classes also improves the extensibility of a software product.
12
Use of delegation to share behavior when inheritance is semantically invalid
This can be avoided by making one class an attribute or associate of the other class.
In this way, one object can selectively invoke the desired functions of another class,
using delegation rather than inheritance.
During the object design phase, all the associations in the object model should be
implemented. To make a decision for implementation, one must analyze the way the
associations are used.
13
One-way Associations: A unidirectional association can be implemented as a
pointer. If the multiplicity is one as shown in figure below, then a simple pointer is
used. If the multiplicity is many, then a set of pointers is used. If the many-end is
ordered, then a list can be used instead of a set. A qualified association with
multiplicity one can be implemented as a dictionary object.
Works-for
Person Company
Person Company
employer employees
14
Works-for
Person Company
Person Company
employer employees
Set
(Person) Works-for
(Company)
(Person)
(Person)
(Company)
(Person)
(Person)
Implementation of an association as an object
15
direction and one for the backward direction. Access is slightly slower than with
attribute pointers, but if hashing is used then the access is still of constant time.
The object designer has to choose when to use primitive types in representing the
objects or when to combine the groups of objects. A class can be defined in terms
of other classes but ultimately all data members have to be defined in terms of built-
in data types supported by a programming language. For example, roll no. can be
implemented as integer or string. In another example, a two dimensional can be
represented as one class or it can be implemented as two classes – Line class and
Point class.
Modularity is the property of a system that has been decomposed into a set of
cohesive and loosely coupled modules. Modules serve as the physical containers in
which we declare the classes and objects of our logical designs. A module can be
edited, compiled or imported separately. Different object-oriented programming
languages support the packing in different ways. For example, Java supports in the
form of package, C++ in the form of header files etc.
Modules are program units that manage the visibility and accessibility of names.
Following purposes can be solved by modularity.
16
• A module typically groups a set of class definitions and objects to
implement some service or abstraction.
• A module is frequently a unit of division of responsibility within a
programming team. A module provides an independent naming
environment that is separate from other modules within the program.
• Modules support team engineering by providing isolated name spaces.
• Information Hiding
• Coherence of Entities
• Constructing Physical Modules
Information Hiding: During analysis phase we are not concerned with information
hiding. So, visibilities of class members are not specified during analysis phase. It is
done during object design phase. In a class, data members and internal operations
should be hidden, so, they should be specified as private. External operations form
the interface so they should be specified as public.
17
Coherence of Entities: Module, class, method etc. are entities. An entity is said to
coherent, if it is organized on a consistent plan and all its parts fit together toward a
common goal.
A policy method does not have complex algorithms rather invokes various
implementation methods. It can contain I/O statements, conditional statements and
can access data stores.
An implementation method does exactly one operation, without making any decision,
assumption, default or deviation. All its information is supplied by arguments. These
methods do not contain any context-dependent decision so they are likely to be
reusable.
6.2.2 Documentation
All design decisions must be properly documented when they are complete.
Documentation is the best practice to remember design details and for transmitting
the designs to others and for recording it for future references during maintenance
18
tasks. The design document should be documented by extending requirements
analysis document, by adding details to the object and functional models.
The design document must include a revised and much more detailed description of
the object model, both in graphical and textual forms. The traversal directions of
associations can be shown using proper arrow pointers. It is a good idea to keep
design document distinct from analysis document. The design document includes
many optimizations and implementations artifacts. Therefore, it is important to keep
detailed information about internal operations and user oriented description of the
system.
The clear and well-written documentation helps to trace an element in the original
analysis to the corresponding element in the design document. The design
document must be straightforward and must be an evolution of the analysis model.
There are mainly three aspects which most of the executable languages are able to
implement.
19
of data, and the record, a heterogeneous collection. An array may represent a vector
of numbers, a list of strings.
Flow of control: Programming languages provide statements for control flow. Control
flows can be expressed either procedurally (conditions, loops and calls) or non
procedurally (rules, constraints, tables and state machines). Non-procedural
languages such as rule based systems, real time systems etc. support entirely
different ways of organizing programs.
Database systems offer the more appropriate form of implementation where the
main concern is to access data in a persistent manner. Most of the database
systems have built-in features for concurrent execution, which provides a high
degree of parallelism. Database commands operate on sets of records leading to
faster execution and reduced access time. Generally databases provide a data
definition language to declare the structure of the data. A query language may also
be provided which allows querying, updation, deletion, modification etc. The query
language may also offer the features of a programming language such as defining
and execution of stored procedures.
20
6.3 Summary
21
• The object designer has to choose when to use primitive types in
representing the objects or when to combine the groups of objects.
• Modules serve as the physical containers in which we declare the classes
and objects of our logical designs. A module can be edited, compiled or
imported separately.
• An entity is said to coherent, if it is organized on a consistent plan and all its
parts fit together toward a common goal.
• A policy method does not have complex algorithms rather invokes various
implementation methods. It can contain I/O statements, conditional
statements and can access data stores.
• An implementation method does exactly one operation, without making any
decision, assumption, default or deviation. All its information is supplied by
arguments. These methods do not contain any context-dependent decision so
they are likely to be reusable.
• Documentation is the best practice to remember design details and for
transmitting the designs to others and for recording it for future references
during maintenance tasks.
• Most of the database systems have built-in features for concurrent execution,
which provides a high degree of parallelism.
• The query language may also offer the features of a programming language
such as defining and execution of stored procedures.
22
6.5 Self-Assessment Questions
1. What do you mean by object design? What are the steps followed during the
object design?
2. How can you combine object model, dynamic model and functional model to
obtain operations on classes?
3. What are the steps an object designer has to follow during algorithm design?
4. How do you optimize the design during the object design phase?
5. Discuss the basic strategies to implement control.
6. How do you design associations?
7. Discuss different ways of increasing inheritance.
8. How can you implement one-way, two-way and link attribute associations?
9. How do you document your design decisions?
10. What are partitions and layers in a system?
23