Oomd Subject Notes
Oomd Subject Notes
Oomd Subject Notes
MODULE I
1.1 Introduction
(i)Object
Data can be quantized into discrete, distinguishable entities which are called
objects.
(ii) Object Oriented Approach means organizing software as a collection of
discrete objects that incorporate both data structure and behavior.
1.2 Object Oriented Development is a new way of thinking about software
based on abstractions that exist in the real world as well as in the program.
1.3 Object Oriented Methodology is a methodology for object oriented
development and a graphical notation for representing objects oriented concepts. We
can call this methodology as OMT. The methodology has the following stages:
1. Analysis - An analysis model is a concise, precise abstraction of what the
desired system must do, not how it will be done. It should not contain any
implementation details. The objects in the model should be application domain
concepts and not the computer implementation concepts.
2. System design - The designer makes high level decisions about the overall
architecture. In system design, the target system is organized as various
subsystems based on both the analysis structure and the proposed architecture.
3. Object design - The designer builds a design model based on the analysis
model but containing implementation details. The focus of object design is the
data structures and algorithms needed to implement each cycle.
4. Implementation - The object classes and relationships developed during
object design are finally translated into a particular programming language,
database, or hardware implementation. During implementation, it is important to
follow good software engineering practice so that the system can remain the
traceability, flexibility and extensibility.
The OMT methodology uses three kinds of models
• Object Model-describes the static structure of the objects in a system and their
relationships. This model mainly contains object diagrams.
1
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
• Dynamic Model-describes the aspects of a system that change over time. This
model mainly contains state diagrams.
• Functional Model-describes the data value transformations within a system.
This model contains the data flow diagrams
1.4 Object Oriented Themes:
There are several themes in an object oriented technology. These themes are not
unique to object oriented systems. We can see some important themes:
• Abstraction-Abstraction consists of focusing on the essential, inherent aspects
of an entity and ignoring its accidental properties. In system development, it
focuses only on what an object is and does, before deciding how it should be
implemented.
• Encapsulation- It can also be called as information hiding. It consists of
separating the external aspects of an object, which are accessible to other objects,
from the internal implementation details of the object, which are hidden from
other objects. It is not unique to object oriented languages.
• Combining Data and Behavior-The caller of an operation need not consider
how many implementations of a given operation exist. Operator polymorphism
shifts the burden of deciding what implementation to use from the calling code to
the class hierarchy. As an example, let us talk about an object oriented program
calling a draw procedure for drawing different figures say a polygon, circle, or
text. The decision of which procedure to use is made by each object, based on its
class.
• Sharing- Inheritance of both data structure and behavior allows a common
structure and behavior allows common structure to be shared among several
similar subclasses without redundancy. The sharing of code using inheritance is
one of the main advantages of object oriented languages.
1.5 Object Modeling: A model is an abstraction of something for the purpose
of understanding it before building it. It is easier to manipulate than the
original entity.
An object model captures the static structure of a system, relationships
between the objects, and the attributes and operations that characterize each class
of objects. This model is the most important one. Some basic concepts covered in
object modeling:
2
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
(a) Objects: We can define an object as a concept, abstraction, or thing with crisp
boundaries and meaning for the problem at hand. All objects have identity and are
distinguishable.eg:- Two apples can be described as 2 different objects even
though they have the same descriptive properties.
(b) Classes: An ‘object class’ or ‘class’ describes a group of objects with similar
properties, common behavior, common relationships to other objects, and
common semantics.
Eg: - Suppose you have a person class –you can term J S, M S, etc. to be objects
of that class.
(c)Object Diagrams: They provide a formal graphic notation for modeling objects,
classes and their relationships to one another.
3
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Attributes are listed in the second part of the class box. So in the above example,
Fig.1.3 Operations
• Each attribute name may be followed by operational details, list of attributes and
list of operations.
• Each operation name may be followed by operational details such as operational
details such as argument list and result type.
1.6 Links and associations: They are used for establishing relationships
among objects and classes.
Link- A link is a physical or conceptual connection between object instances .We
can say that a link is an instance of an association.
Eg: - J S works for Simplex company.
Association –Describes a group of links with common structure and common semantics’:-
A person works for a company.
They are inherently bidirectional. It means that a binary association can be traversed in
both directions. They are implemented as pointers.
4
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Fig.1.5 Instance
Diagram
5
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
* The OMT notation for a link attribute is a box attached to the association by a loop
ii) Role names – A role is an end of an association. Role name is a name that uniquely
identifies one end of an association.
Eg: - “Person works for a Company.” Here the person plays the role of an employee
and the company the role of the employer.
iii) Ordering -Sometimes, the objects are explicitly ordered. For example, the figure
below shows a workstation screen containing a number of overlapping windows. The
windows are explicitly ordered, so only the topmost window is visible at any point on
the screen.
6
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
7
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
8
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
In the above figure, you can see that display must be implemented separately
for each kind of figure, although it is defined for any kind of figure.
1.9 Grouping Constructs:
a) Module- A module is a logical construct for grouping classes, associations,
and generalizations. It captures one view of a situation.
For example: Let us say, electrical, plumbing, etc. are different views of a
building.
An object model consists of one or more modules. Class names and
association names must be unique within a module. Module names are usually
listed at the top of each sheet. The same class may be referenced in many
modules.
b) Sheet- A sheet is a mechanism for breaking a large object model down into
a series of pages. A sheet is a single printed page. Each module consists of one
or more sheets.
Each sheet has a title and a name or number. Each association/generalization
appears on a single sheet. Classes may appear on multiple sheets.
.
9
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
10
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
The above figure shows the aggregation and generalization in the case of a
desk lamp.
Aggregation is sometimes called an “and-relationship” and generalization an
“or-relationship”.
• Recursive Aggregates Aggregation can be fixed, variable or recursive.
A fixed aggregate has a fixed structure; the number and types of subparts
are predefined. The desk lamp in figure 4.2 is a fixed aggregate.
A variable aggregate has a finite number of levels, but the number of
parts may Vary.The Company in Fig.4.1 is a variable aggregate.
A recursive aggregate contains, directly or indirectly, an instance of the
same kind of aggregate; the number of potential levels is unlimited.Fig4.3
shows a recursive aggregate.
11
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Fig.1.18Propagation of operations
12
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Fig 1.21
13
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
1.12 Generalization as Extension and Restriction : By now you are all familiar
with what is meant by generalization.
In generalization, an instance of a class is an instance of a class is an instance of all
ancestors of the class. Therefore you can say that all ancestor class features must apply to
the subclass instances. This includes not only the attributes on the ancestor classes but
also the operations on the ancestor class.
A subclass may include many features, which is called as an extension. For example,
fig.4.7 extends class Employee with three subclasses that inherit all Employee features
and add new features of their own.
A subclass may also constrain ancestor attributes. This is called restriction because it
restricts the values that instances can assume. For example, a circle is an ellipse whose
major and minor axes are equal.Arbitary changes to the attribute values of a restricted
subclass may cause it to violate the constraints, such that the result no longer belongs to
the original subclass. This is not a problem from the perspective of the superclass because
the result is still a valid superclass instance. For example, a circle that is scaled unequally
in the x and y dimensions remains an ellipse but is no longer a circle.
* The inherited features can be renamed in a restriction
For example, the inherited features can be renamed the diameter.
Class membership can be defined in two ways: implicitly by rule or explicitly by
enumeration.
Overriding Operations:
Overriding is done for many reasons:
• Overriding for Extension: For example, suppose say you have a Window superclass
and a Window Labeled subclass. Now this superclass has draw operations that is used to
draw the Window boundary and contents. The subclass has an operation draw-Labeled
Window. The method could be invoked by invoking the method to draw a window and
then adding a code to draw the label.
• Overriding for Restriction: This is quite necessary when you have to keep the
inherited operations closed within the subclass. For example, the suprclass Set may have
the operation add(object).the subclass IntegerSet would then have the more restrictive
operation add(integer).
• Overriding for Optimization::
• Overriding for Convinience:
14
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
1.13 Multiple Inheritance: It permits a class to have more than one superclass and
to inherit features from all parents. It rathers allows mixing of information from two or
mores sources. Now what is the advantage of multiple inheritance?
Well it provides increased opportunity for reuse. And to speak about its disadvantage, is a
loss of conceptual and implementation simplicity.
Definition:
A class may inherit features from more than one class. A class with more than one
superclass is called a join class. A feature from the same ancestor class found along more
than one path is inherited only once; it is the same feature. Conflicts among parallel
definitions create ambiguities that must be resolved in implementation.
Here in the above example, Amphibious Vehicle is a join class. If a class can be refined on
several distinct and independent dimensions, then use multiple generalizations.
15
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
1.14 Metadata-is data that describes other data. For example, the definition
of a class is metadata. Models are inherently metadata, since they describe the
things being modeled.
1.15 Candidate Keys – It is a minimal set of attributes that uniquely
identifies an object or link. It means you can’t discard an attribute from the
candidate key and still distinguish all objects and links. A class or association
may have one or more candidate keys, each of which may have different
combinations and numbers of attributes. The object id is always a candidate
key for a class. One or more combinations of related objects are candidate
keys for associations.
• A candidate key is delimited with braces in an object model.
Fig. 1.24 Comparison of multiplicity with candidate keys for binary associations
16
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
MODULE 2
2.1What is dynamic modeling?
Temporal relationships are difficult to understand .A system can be best
understood by first examining its staitic behavior. Then next we examine the
changes to the objects and their relationships over time. Those aspects of a
system that are concerned with time and changes are the dynamic model.”
Control is that aspect of a system that describes the sequences of operations
that occur in response to external stimuli without consideration of what the
operations do , what they operate on, or how they are implemented.
The major dynamic modeling concepts are:
17
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
• events, states
• state diagrams
2.2 Events and States:
“The attribute values and links held by an object are called its state. Over time,
the objects stimulate each other, resulting in a series of changes to their states.”“
An individual stimulus from one object to another is an event.” The response of
an event depends on the state of the object receiving it, and can include a change
of state or the sending of another event to the original sender or to a third object.
“The pattern of events, states and state transitions for a given class can be
abstracted and represented as a state diagram.”
The dynamic model consists of multiple state diagrams, one state diagram for
each class with important dynamic behavior, and shows the pattern of activity
for an entire system. The state diagrams for the various classes combine into a
single dynamic model via shared events.
1) Events:
“An event is something that happens at appoint in time.”
Eg:-Flight 123 departs from Chicago.
An event has no duration. One event may logically precede or follow another, or
the two events may be unrelated.
Eg:-Flight 123 must depart Chicago before it can arrive in San Francisco; the
two events are casually related.
“Two events that are casually unrelated are said to be concurrent; they have no
effect on each other.” Concurrent events can occur in any order.
An event is a one way transmission of information from one object to another.
An object sending an event to another object may expect a reply, but the reply is
a separate event under the control of the second object, which may or may not
choose to send it.
Every event is a unique occurrence but we group them into event classes and
give each event class a name to indicate common structure and behavior.
Eg:-Flight 123 departs from Chicago.
Flight 456 departs from Rome.
Both are instances of the event class airplane flight departs.
18
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Some events are signals, but most event classes have attributes indicating the
information they convey.eg:-airplane flight departs has attributes airline, flight
number and city. The time at which each event occurs is an implicit attribute of
an event.
An event conveys information from one object to another. Some classes of
events may be simply signals that something has occurred, while other classes of
events convey data values. The data values conveyed by events are its attributes,
like data values held by its objects. Attributes are shown in the parentheses after
the event class name.
Fig.2.2Scenario
for phone call
The next step
after writing a
scenario is to
identify the
sender and
receiver
objects of each
event.
19
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
“The sequence of events and the objects exchanging events can both be shown in
an augmented scenario called event trace diagram.” 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.
3) States
A state is an abstraction of the attribute values and links of an object. The set of
values are grouped together into a state according to properties that affect the
gross behavior of the object.
For example, let us consider the state of a bank. It can either in a solvent or an
insolvent state depending on whether it assets exceeds its liabilities.
A state specifies the response of the object to input events. The response to an
event may vary quantitatively depending on the exact value of its attributes .The
response is the same for values within the same states but different for values in
different states.
The response of an object to an event may include an action or a change of state
by the object.
Eg:-if a digit is dialed in state dial tone the phone line drops the dial tone and
enters dialing.
A state corresponds to the interval between two events received by an object.
Events represent points in time; states represent intervals of time.
For example, in the phone example, after the receiver is lifted and before the first
digit is dialed, the phone line is in Dial Tone state.
The state of an object depends on the past sequence of events it has received, but
in most cases past events are eventually hidden by subsequent events.
For example, Events that has happened before the phone is hung up have no
effect on future behavior.
A state has duration. A state is often associated with a continuous activity .eg:-
ringing of phone. Events and states are duals i.e. an event separates two states and
a state separates 2 events. A state is often associated with the value of an object
satisfying some condition. For example, Water is liquid when temperature of
water is greater than zero degrees Celsius and below 100 degree Celsius.
Both events and states depend on the level of abstraction used. For example,
travel agent planning an itinerary would treat each segment as a single event, but
a flight status board will treat it as 2 events departure and arrival.
20
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
21
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
“One shot diagrams represent objects with finite lives.” The initial state is entered
on the creation of the object. Final state is entered on the destruction of the object.
The state diagram in the phone example was that of a continuous system.
Initial state is shown by a solid circle while a final state is shown by a solid circle.
5) Conditions
“A condition is a Boolean function of object values. For example, when we say
the temperature was below freezing point from Nov to March.
Here the condition to be temperature below freezing point .It has duration. A state
can be defined in terms of a condition; conversely being in a state is a condition.
Conditions can be used as guards on transitions “A guarded transition fires when
its events occur but only if the condition is true.
For example, let us say a person goes out in the morning (event), if the
temperature is below freezing (condition) , then put on your gloves(next state).
A guarded condition on a transition is shown as a Boolean expression in brackets
following event name.
Fig 2.3
Now that we have learnt about states, events, etc. Let us go into the advanced
concepts. Let us first discuss on the operations
2.3 Operations
The state diagrams describe the pattern of events and states for a single object
class. How to trigger operations?
i) Controlling Operations
State diagrams could be of little use if they just described the patterns of the
events. A behavior description of an object must specify what the object does in
response to events .Operations attached to states / transitions are performed in
response to corresponding states or events.
“An activity is an operation that takes time to complete.”
* An activity is associated with a state.
* Activities include continuous as well as sequential events.
22
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
*A state may control a continuous activity that persists until an event terminates it
by calling a transition from the state.
* do: activity within state box indicates that activity starts an entry to the state and
stops on exit.
*In the case of sequential events also it is the same thing.
* If an event causes a transition from the state before the activity is complete, it
terminates prematurely.
“An action is an instantaneous operation.”
• it is associated with an event
• Actions can also represent internal control operations, such as setting
attributes or generating other events.
• Notation (‘/’ on transition) for action and the name (or description of
the action following the name of the event that causes it.
23
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
2.5 Concurrency
a) Aggregation Concurrency
A dynamic model describes a set of concurrent objects. A state of an entire system
can’t be represented by a single state in a single object. It is the product of the states
of all objects in it. A state diagram for an assembly is a collection of state diagram,
one for each component. By using aggregation we can represent concurrency.
Aggregate state corresponds to combined state of all component diagrams.
b) Concurrency within an object
Concurrency within a single composite state of an object is shown by partitioning the
composite state into sub diagrams with dotted lines.
2.6 Advanced dynamic modeling concepts.
i) Entry and Exit Actions
As an alternative to showing actions on transitions, actions can be associated
with entering or exiting a state. Exit actions are less common. What about the order
of execution of various actions and events associated with states and events?
Of all the action on the incoming transition will be executed first, then the entry
action, followed by the activity within the state, followed by the exit action and
finally the action on the outgoing action.
The activities can be interrupted by events causing transitions out of state but
entry and exit can’t be interrupted. The entry/exit actions are useful in state
diagrams .A state can be expressed in terms of matched entry-exit actions.
ii) Internal Actions
An event can cause an action to be performed without causing a state
change .The event name is written inside state box followed by ‘/’ . Now to
differentiate betw
een a self-transition and an internal action. Self-transition causes an entry and exit
action to be executed but an internal action does not.
iii) Automatic Transition
A state performs a sequential activity. When it is over, the transition to another
fires. An arrow without an event name indicates an automatic transition that fires
when the activity associates with the source state is completed.
If there is no activity, the unlabeled transitions fires as soon as the state is entered.
Such transitions are called as ‘lambda’ transitions.
24
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
25
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Dividend Quotient
Integer
Division
Divisor Remainder
Fig2.4: process
ii) Data Flows
A data flow connects the output of an object or process to the input of another
object or process. It represents an intermediate data value within a
computation. A data flow is drawn as an arrow. Sometimes an aggregate data
value is split into its components, each of which goes to a different process.
Flows on the boundary of a data flow diagram are its inputs and outputs.
Street address
Number Address
City
State
ZIP Code
iii) Actors
An actor is an active object that drives the data flow graph by producing or
consuming values. Actors are attached to the inputs and outputs of a data flow
26
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
graph. The actors are lie on the boundary of the data flow graph. An actor is
drawn as a rectangle.
Application size
location
Icon name vector list window vector list
Expand into Clip Offset
vectors vectors vectors
Location
Screen
vector
Convert
Screen buffer to pixels
list
Pixel
Operations
Fig:2.6 Data flow diagram for windowed graphics display
access. A data store is drawn as a pair of parallel lines containing the name of the
store. Input arrows indicate information or operations that modify the stored data.
Output arrows indicate information retrieved from the store. Both actors and data
27
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Account
Verify password
Verify
Balance
Password Password Ok
Cash
Customer Update
28
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Amount
2.10Constraints
A constraint shows the relationship between two objects at the same time or
between different values of the same object at different times. A constraint may be
expressed as a total function or a partial function. Object constraints specify that
some objects depend entirely or partially on other objects. Dynamic constraints
specify relationships among the states or events of different objects. Functional
constraints specify restrictions on operations.
2.11Relation of Functional to Object and Dynamic Models.
The functional model shows what has to be done by a system. The leaf processes
are the operations on objects. The processes in the functional model correspond to
29
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
operations in the object model. Processes in the functional model show objects
that are related by function.
A process is usually implemented as a method.
Module 3
3.1Problem statement
The first step to develop anything is to state the requirements. Being vague about your
objective only postpones decisions to a later stage where changes are much costly.
The problem statement should state what is to be done and not how it is to be done. It
should be a statement of needs, not a proposal for a solution. The requestor should
indicate which features are mandatory and which are optional; to avoid overly
constraining design decisions. The requestor should avoid describing system internals.
30
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
A problem statement may have more or less detail. Most problem statements are
ambiguous, incomplete or even inconsistent. Some requirements are wrong. Some
requirements have unpleasant consequences on the system behavior or impose
unreasonable implementation costs. Some requirements seem reasonable first. The
problem statement is just a starting point for understanding problem. Subsequent
analysis helps in fully understanding the problem and its implication.
3.2Object Modeling
The first step in analyzing the requirements is to construct an object model. It
describes real world object classes and their relationships to each other. Information
for the object model comes from the problem statement, expert knowledge of the
application domain, and general knowledge of the real world. If the designer is not a
domain expert, the information must be obtained from the application expert and
checked against the model repeatedly. The object model diagrams promote
communication between computer professionals and application domain experts.
The steps for object modeling are:
1. Identifying Object Classes
The first step in constructing an object model is to identify relevant object
classes from the application domain. The objects include physical entities as well as
concepts. All classes must make sense in the application domain; avoid computer
implementation constructs such as linked lists. Not all classes are explicit in the
problem statement; some are implicit in the application domain or general knowledge.
31
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
• Vague Classes - A class should be specific .Some tentative classes may have
ill-defined boundaries or be too broad in scope.
• Attributes - Names that primarily describe individual objects should be
restated as attributes. If independent existence of a property is important, then
make it a class and not an attribute.
• Operations - If a name describes an operation that is applied to objects and not
manipulated in its own right, then it is not a class.
• Roles - The name of a class should reflect its intrinsic nature and not a role
that it plays in an association.
• Implementation Constructs - Constructs extraneous to real world should be
eliminated from analysis model. They may be needed later during design, but not
now.
3. Preparing a data dictionary
Prepare a data dictionary for all modeling entities .Write a paragraph precisely
describing each object class. Describe the scope of the class within the current
problem, including any assumptions or restrictions on its membership or use. Data
dictionary also describes associations, attributes and operations.
4. Identifying Associations
Identify associations between classes .Any dependency between two or more classes
is an association. A reference from one class to another is an association. Associations
often correspond to stative verbs or verb phrases. These include physical location
(next to, part of), directed actions (drives), communication (talks to), ownership (has,
part of) or satisfaction of some kind (works for). Extract all the candidates from the
problem statement and get them down on to the paper first, don’t try to refine things
too early. Don’t spend much time trying to distinguish between association and
aggregation. Use whichever seems most natural at the time and moves on.
Majority of the associations are taken from verb phrases in the problem statement. For
some associations, verb phrases are implicit. Some associations depend on real world
knowledge or assumptions. These must be verified with the requestor, as they are not
in the problem statement.
32
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
33
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
6. Identifying Attributes
Identify object attributes. Attributes are properties of individual objects, such as name,
weight, velocity, or color. Attributes shouldn’t be objects, use an association to show
any relationship between two objects. Attributes usually correspond to nouns
followed by possessive phrases, such as the ‘color of the car’. Adjectives often
represent specific enumerated attribute values, such as red. Unlike classes and
associations, attributes are less likely to be fully described in the problem statement.
You must draw on your knowledge of the application domain and the real world to
find them. Attributes seldom affect the basic structure of the problem. Only consider
attributes that directly relate to a particular application. Get the most important
attributes first, fine details can be added later. Avoid attributes which are solely for
implementation. Give each attribute a meaningful name. Derived attributes are clearly
labeled or should be omitted. e.g.:- age. Link attributes should also be identified. They
are sometimes mistaken for object attributes.
34
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Link Attributes: If a property depends on the presence of a link, then the property
is an attribute of the link and not of related objects. Link attributes are usually obvious
on many to many associations, they can’t be attached to the “many” objects without
losing information. Link attributes are also subtle on one-one association.
Internal values: If an attribute describes the internal state that is invisible outside
the object, then eliminate it from the analysis.
Fine detail: Omit minor attributes which are unlikely to affect most operations.
Discordant attributes: An attribute that seems completely different from and
unrelated to all other attributes may indicate a class that should be split into two
distinct classes.
35
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
3.3Dynamic Modeling:
Dynamic Modeling shows the time-dependent behavior of the system and the objects
in it. Begin dynamic analysis by looking for events-externally visible stimuli and
responses. Summarize permissible event sequences for each object with a state
diagram. Dynamic model is insignificant for a purely static data repository. It is
important in the case of interactive systems. For most problems, logical correctness
depends on the sequences of interactions, not the exact time of interactions. Real time
systems do have specific timing requirements on interactions that must be considered
during analysis.
36
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
implementation. If possible, allow the user to abort an operation or roll back to a well
defined starting point at each step.
• Finally consider various other kinds of interactions that can be overlaid on basic
interactions, such as help requests and status queries.
• A scenario is a sequence of events .An event occurs when information is
exchanged between an object in the system and an outside agent, such as user. The
values exchanged are parameters of the event. The events with no parameters are
meaningful and even common. The information in such event is the fact that it has
occurred a pure signal. Anytime information is input to the system or output from the
system.
• For each event identify the actor (system, user or other external agent) that caused
the event and the parameters of the event.
• The screen layout or output format generally doesn’t affect the logic of the
interaction or the values exchanged.
• Don’t worry about output formats for the initial dynamic model; describe output
formats during refinement of the model.
(ii) Interface Formats
Most interactions can be separated into two parts:
• application logic
• user interface
Analysis should concentrate first on the information flow and control, rather than the
presentation format. Same program logic can accept input from command lines, files,
mouse buttons, touch panels, physical push buttons, or carefully isolated. Dynamic
model captures the control logic of the application. It is hard to evaluate a user
interface without actually testing it .Often the interface can be mocked up so that
users can try it. Application logic can often be simulated with dummy procedures.
Decoupling application logic from user interface allows “look and feel” of the user
interface to be evaluated while the application is under development.
(iii) Identifying Events
Examine the scenario to identify all external events. Events include all signals, inputs,
decisions, interrupts, transitions, and actions to or from users or external devices.
Internal computation steps are not events, except for decision points that interact with
the external world .Use scenarios to find normal events, but don’t forget error
37
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
38
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
using one subdiagram for the main line and the other for the distinguishing
information. After normal events have been considered, add boundary cases and
special cases. Handling user errors needs more thought and code than normal case.
You are finished with the state diagram of a class when the diagram handles all events
that can affect an object of the class in each of its states. If there are complex
interactions with independent inputs, we use nested state diagrams. Repeat the above
process of building state diagrams for each class of objects. Concentrate on classes
with important interactions. Not all classes need state diagrams. Many objects respond
to input events independent of their past history, or capture all important history as
parameters that do not affect control. Such objects may receive and send events. List
the input events for each object and output event sent in response to each input event,
but there will be no further state structure. Eventually you may be able to write down
state diagram directly without preparing event traces.
(v) Matching Events between Objects.
Check for completeness and consistency at the system level when the state diagram
for each class is complete .Every event should have a sender and a receiver,
occasionally the same object .States without predecessors or successors are
suspicious; make sure they represent starting or termination points of the interaction
sequences .Follow the effects of an input event from object to object through the
system to make sure that they match the scenario. Objects are inherently concurrent;
beware of synchronization errors where an input occurs at an awkward time. Make
sure that corresponding events on different state diagrams are consistent. The set of
state diagrams for object classes with important dynamic behavior constitute the
dynamic model for the application.
3.4Functional Modeling
The functional model shows how values are computed, without regard for sequencing,
decisions or object structure. It shows which values depend on which other values and
which function relate them. The dfds are useful for showing functional
dependencies .Functions are expressed in various ways, including natural language,
mathematical equations and pseudo code. Processes on dfd corresponds to activities
or actions in the state diagrams of the class. Flows on dfd correspond to objects or
39
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
attribute values on attribute values in object diagram. Construct the functional model
after the two models. The following steps are performed in constructing functional
model:
(i) Identifying input and output values
List input and output values. The input and output values are parameters of events
between system and outside world. Find any input or output values missed.
(ii) Building DFD
Now construct a DFD, show each output value is completed from input values. A
DFD is usually constructed in layers. The top layer may consist of a single process, or
perhaps one process to gather inputs, compute values, and generate outputs. Within
each dfd layer, work backward from each output value to determine the function that
computes it. If the inputs are operations are all inputs of the entire diagram, you are
done; otherwise some of the operation inputs are intermediate values that must be
traced backward in turn. You can also trace forward from inputs to outputs, but it is
usually harder to identify all users of an input, than to identify all the sources of an
output.
o Expand each non trivial process in the top level DFD into a lower level DFD.
o Most systems contain internal storage objects that retain values between
iterations. An internal store can be distinguished from a data flow or a process
because it receives values that don’t result in immediate outputs but are used at
some distant time in the future.
o The DFD show only dependencies among operations. They don’t show
decisions.(control flows)
iii) Describing Functions
When the dfd has been refined enough, write a description of each function.
The description can be in natural language, mathematical equations, pseudocode,
decision tables, or some appropriate form.
o Focus on what the function does, and not how it is implemented.
o The description can be declarative or procedural.
o A declarative description specifies the relationships between input and output
values and the relationships among output values.
For example, “sort and remove duplicate values”
40
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Declarative: “Every value in the input list appears exactly once in the output list, and
the values in the output list are in strictly increasing order.”
Procedural:-specifies function by giving an algorithm to compute it. The purpose of
the algorithm is only to specify what the function does.
A declarative description is preferable; they don’t imply implementation but if
procedural is easy it should be used.
iv) Identify constraints between objects
Identify constraints between objects. Constraints are functional
dependencies between objects that are not related by an input output dependency.
Constraints can be on two objects at the same time, between instances of the same
object at different times (an invariant) or between instances of different object at
different times.
-> Preconditions on functions are constraints that the input values must satisfy.
-> Post conditions are constraints that the output values are guaranteed to hold.
-> State the times or conditions under which the constraints hold.
3.5System Design
System design is the high-level strategy for solving the problem and building a
solution.
The steps involved in system design are:
41
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Most interactions should be within subsystems rather than across boundaries and it
reduces dependencies among subsystems.
Layered system is an ordered set of virtual worlds, a layer knows about the layer
below but not above. A client supplier relationship exists between lower layers and
upper layers.
Partitions divide into several independent SS, each providing a type of service. A
system can be a hybrid of layered and partitioned
System Topology defines the flow of information among subsystems. The flow may
be a pipeline (compiler) or star which has a master that controls all other
42
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
interactions. Try to use simple topologies when possible to reduce the number
of interactions between subsystems.
In analysis as in the real world and in hardware all objects are concurrent. In
implementation not all software objects are concurrent because one processor may
support many objects. An important goal of system design is to identify which object
must be active concurrently and which objects have activity that is mutually exclusive
(not active at the same time). The latter objects can be folded into a single thread of
control or task (runs on a single processor).
Dynamic Modeling is the guide to concurrency - Two objects are said to be inherently
concurrent if they can receive events at the same time without interacting. If the
events are unsynchronized, the objects cannot be folded into a single thread of
control. (engine and wing control on an airplane must operate concurrently)
Two subsystems that are inherently concurrent need not necessarily be implemented
as separate hardware units. The purpose of interrupts, Operating System and tasking
mechanism is to simulate logical concurrency in a uniprocessor - so if there are no
timing constraints on the response then a multitasking Operating System can handle
the computation.
All objects are conceptually concurrent, but many objects are interdependent. By
examining the state diagram of individual objects and the exchange of events between
them, many objects can be folded into a single thread of control. A thread of control is
a path through a set of state diagrams on which only a single object at a time is active
- thread remains in a state diagram until an object sends an event to another object and
waits for another event.
On each thread of control only a single object is active at a time. Threads of control
are implemented as tasks in computer systems.
43
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
The decision to use multiple processors or hardware functional units is based on the
need for higher performance than a single CPU can provide (or fault tolerant
requests). Numbers of processors determine the volume of computations and speed of
the machine.
The system designer must estimate the required CPU power by computing the steady
state load as the product of the number of transactions per second and the time
required to process a transaction. Experimentation is often useful to assist in
estimating.
Hardware/Software Tradeoffs
Hardware can be viewed as a rigid but highly optimized form of software. The system
designer must decide which subsystems will be implemented in hardware and
which in software.
Existing hardware provides exactly the functionality required – e.g. floating point
processor
44
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Computation rates are too great for single processor, so tasks must be spread among
several processors.
The internal and external data stores in a system provide clean separation points
between subsystems with well defined interfaces. Data stores may combine data
structures, files, and database implemented in memory or on secondary storage
devices. The different data stores provide trade-offs between cost, access time,
capacity and reliability.
Files are cheap, simple and permanent form of data store. File operations are low level
and applications must include additional code to provide a suitable level of
abstraction. File implementations vary from machine to machine so portability is
more difficult.
Databases are powerful and make applications easier to port. They do have a complex
interface and may work awkwardly with programming languages.
45
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
The system designer must identify the global resources and determine mechanisms for
controlling access to them - processors, tape drives, etc
If the resource is a physical object, it can control itself by establishing a protocol for
obtaining access within a concurrent system. If the resource is logical entity (object
ID for example) there is a danger of conflicting access. Independent tasks could
simultaneously use the same object ID. Each global resource must be owned by a
guardian object that controls access to it.
There are two kinds of control flows in a software system: external control and
internal control. Internal control is the flow of control within a process. It exists
only in the implementation and therefore is not inherently concurrent or
sequential. External control is the flow of externally visible events among the
objects in the system.
46
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Event driven systems - control resides within a dispatcher or monitor provided by the
language, subsystem or operating system. Application procedures are attached to
events and are called by the dispatcher when the corresponding events occur.
3. Failure: It is the unplanned termination of a system. Failure can arise from user
errors, from the exhaustion of system resources, or from an external breakdown.
47
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
There are several prototypical architectural frameworks that are common in existing
systems. Each of these is well-suited to a certain kind of system. If we have an
application with similar characteristics, we can save effort by using the corresponding
architecture, or at least use it as a starting point for our design. The kinds of systems
include:
1. Batch transformation: It is a data transformation executed once on an entire input
set. A batch transformation is a sequential input-to-output transformation, in which
inputs are supplied at the start, and the goal is to compute an answer. There is no
ongoing interaction with the outside world. The most important aspect of the batch
transformation is the functional model which specifies how input values are
transformed into output values. The steps in designing a batch transformation are:
1) Break the overall transformation into stages, each stage performing one
part of the transformation. The system diagram is a data flow diagram.
This can usually be taken from the functional model.
2) Define intermediate object classes for the data flows between each pair
of successive stages.
3) Expand each stage in turn until the operations are straightforward to
implement.
4) Restructure the final pipeline for optimization.
2. Continuous Transformation: It is a system in which the outputs actively depend
on changing inputs and must be periodically updated. Because of severe time
constraints, the entire set of outputs cannot usually be recomputed each time an input
changes. Instead, the new output values must be computed incrementally. The
transformation can be implemented as a pipeline of functions. The effect of each
incremental change in an input value must be propagated through the pipeline. The
steps in designing a pipeline for continuous transformation are:
1. Draw a DFD for the system. The input and output actors correspond to
data structures whose value change continuously. Data stores within the
pipeline show parameters that affect the input-to-output mapping.
2. Define intermediate objects between each pair of successive stages.
3. Differentiate each operation to obtain incremental changes to each stage.
4. Add additional intermediate objects for optimization.
48
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
49
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Module 4
Steps of Design:
During object design, the designer must perform the following steps:
1. Combining the three models to obtain operations on classes.
2. Design algorithms to implement operations.
3. Optimize access paths to data.
4. Implement control for external interactions
5. Adjust class structure to increase inheritance.
6. Design associations.
7. Determine object representation.
8. Package classes and associations into modules.
50
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
51
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
52
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
53
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
terms of lower level operations on simpler objects. These lower level operations
must be defined during object design because most of them are not externally
visible. Some of these operations were found from “shopping –list”. There is a
need to add new internal operations as we expand high –level functions. When
you reach this point during the design phase, you may have to add new classes
that were not mentioned directly in the client’s description of the problem. These
low-level classes are the implementation elements out of which the application
classes are built.
54
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
• If the objects were not software, but the real world objects represented
internally, what real world objects would you push, move, activate or
manipulate to initiate operation?
Assigning an operation within a generalization hierarchy can be difficult. Since
the definitions of the subclasses within the hierarchy are often fluid and can be
adjusted during design as convenient. It is common to move an operation up and
down in the hierarchy during design, as its scope is adjusted.
55
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Examine each operation and see what associations it must traverse to obtain its
information. Note which associations are traversed in both directions, and
which are traversed in a single direction only, the latter can be implemented
efficiently with one way pointers.
For each operation note the following items:
How often is the operation called? How costly is to perform?
What is the “fan-out” along a path through the network? Estimate the average
count of each “many” association encountered along the path. Multiply the
individual fan-outs to obtain the fan-out of the entire path; which represents
the number of accesses on the last class in the path. Note that “one” links do
not increase the fan-out, although they increase the cost of each operation
slightly, don’t worry about such small effects.
What is the fraction of “hits” on the final class , that is , objects that meets
selection criteria (if any ) and is operated on? If most objects are rejected
during the traversal for some reason, then a simple nested loop may be
inefficient at finding target objects. Provide indexes for frequent, costly
operations with a low hit ratio because such operations are inefficient to
implement using nested loops to traverse a path in the network.
ii)Rearranging Execution Order for Efficiency
After adjusting the structure of the object model to optimize frequent
traversal, the next thing to optimize is the algorithm itself. Algorithms and
data structures are directly related to each other, but we find that usually the
data structure should be considered first. One key to algorithm optimization is
to eliminate dead paths as early as possible. Sometimes the execution order of
a loop must be inverted.
iii) Saving Derived Attributes to Avoid Recomputation:
Data that is redundant because it can be derived from other data can be
“cached” or store in its computed form to avoid the overhead of recomputing
it. The class that contains the cached data must be updated if any of the
objects that it depends on are changed.
Derived attributes must be updated when base values change. There are 3
ways to recognize when an update is needed:
56
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
57
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
depending on the input event received. Each input statement need to handle any
input value that could be received at that point. In highly nested procedural
code, low –level procedures must accept inputs that they may know nothing
about and pass them up through many levels of procedure calls until some
procedure is prepared to handle them.
One technique of converting state diagram to code is as follows:
1. Identify the main control path. Beginning with the initial state, identify a
path through the diagram that corresponds to the normally expected
sequence of events. Write the name of states along this path as a linear
sequence of events. Write the names of states along this path as a linear
sequence .This becomes a sequence of statements in the program.
2. Identify alternate paths that branch off the main path and rejoin it later.
These become conditional statements in the program.
3. Identify backward paths that branch off the main loop and rejoin it earlier
.These become loops in program. If multiple backward paths that do not
cross, they become nested loops. Backward paths that cross do not nest and
can be implemented with goto if all else fails, but these are rare.
4. The status and transitions that remain correspond to exception conditions.
They can be handled using error subroutines , exception handling supported
by the language , or setting and testing of status flags. In the case of
exception handling, use goto statements.
ii) State machine engine
The most direct approach to control is to have some way of
explicitly representing and executing state machine. For example, state machine
engine class helps execute state machine represented by a table of transitions
and actions provided by the application. Each object instance would contain its
own independent state variables but would call on the state engine to determine
next state and action. This approach allows you to quickly progress from
analysis model to skeleton prototype of the system by defining classes from
object model state machine and from dynamic model and creating “stubs” of
action routines. A stub is a minimal definition of function /subroutine without
any internal code. Thus if each stub prints out its name , technique allows you to
execute skeleton application to verify that basic flow of control is correct. This
technique is not so difficult.
58
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
4.7Adjustment of Inheritance
The definitions of classes and operations can often be adjusted to increase the
amount of inheritance.
The designer should:
i) Rearrange classes and operations
Sometimes the same operation is defined across several classes and can easily be
inherited from a common ancestor, but more often operations in different classes
are similar but not identical. By slightly modifying the definitions of the
operations or the classes , the operations can often be made to match so that they
can be covered by a single inherited operation. Before inheritance can be used ,
each operation must have the same interface and the types of arguments and
results. If the signatures match, then the operations must be examined to see if
they have the same semantics. The following kinds of adjustments can be used to
increase the chance of inheritance.
• Some operations may have fewer arguments than others .The missing
arguments can be added but ignored.
• Some operations may have few arguments because they are special cases
of more general arguments .Implement the special operations by calling
the general operation with appropriate parameter values.
• Similar attributes in different classes may have different names. Give the
attributes the same name and move them to a common ancestor class.
These operations that access the attributes will match better.
59
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
60
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Fig 4.1
61
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Fig 4.2
62
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
63
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Defining a new class is more flexible but often introduces unnecessary indirection.
In a similar vein, the designer must often choose whether to combine groups of
related objects.
64
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
65
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
implementation methods don’t contain any context dependency. So they are likely
to be reusable Policy method need to be rewritten in an application , they are
simple and consists of high level decisions and calls on low-level methods. A
class shouldn’t serve too many purposes.
66
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
67
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Module 5
The Booch method notation differs from other OO methodologies because it centers
on the development of four fundamental models of the system in the problem domain
that will be implemented primarily in software. These models are:
68
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
The Booch method recognizes that an engineer can view the four models from several
different perspectives. In the Booch method, an engineer can document the models
with several different diagrams:
The engineer augments these diagrams with specifications that textually complement
the icons in the diagrams. It's important to realize that there is not a one-to-one
mapping between a model and a particular view. Some diagrams and/or specifications
can contain information from several models, and some models can include
information that ends up in several diagrams. Each model component and their
relationships can appear in none, one, or several of a models diagram.
i) Class Diagram
A class diagram shows the existence of classes and their relationships in the logical
view of the system. This is the diagram that most people think of when they think of
the Booch notation, because the 'clouds' that represent classes are so unique.
69
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
70
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
In the above figure, the relationship with a dot on the end indicated a ``has''
relationship. The class on the ``dot'' side owns or uses the facilities of the class on the
other end of the line.
An object diagram, or for our purposes here an object-scenario diagram shows the
existence of objects, their relationships in the logical view of the system, and how
they execute a particular scenario or use-case.
71
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
A module diagram shows the allocation of classes and objects to modules in the
physical view of a system.
72
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
73
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
The State Transition diagram shows the state space of a given context, the events that
cause a transition from one state to another, and the actions that result.
v) Interaction Diagrams
The interaction diagrams illustrate how objects interact via messages. They are used
for dynamic object modeling.
74
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
75
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Process 1 Process 2
Processor 2
Processor 1
Processor 3
76
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
The macro process serves as a controlling framework for the micro process and can
take weeks or even months. The primary concern of the macro process is technical
management of the system .Such management is interested less in the actual OOD
than in how well the project corresponds to the requirements set for it and whether it
is produced on time. The macro development process consists of the following steps:
i) Conceptualization: You establish the core requirements of the system .You establish
a set of goals and develop a prototype to prove the concept.
ii) Analysis and Development of the Model: You use the class diagram to describe the
roles and responsibilities objects are to carry out in performing the desired behavior of
the system. Then you use the object diagram to describe the desired behavior of the
system in terms of scenario or use interaction diagram to describe behavior of system
in terms of scenarios.
iii) Design or create the system architecture: You use the class diagram to decide what
classes exist and how they relate to each other. You use object diagram to decide what
mechanisms are used to regulate how objects collaborate .You use module diagram to
map out where each class and object should be declared. You use the process diagram
to determine to which processor .Also determine the schedules for multiple processes
on each relevant processor.
v) Maintenance: Making localized changes to the system to add new requirements and
eliminate bugs.
b) Micro Development Process: Each macro development process has its own micro
development processes. It is a description of the day-to-day activities by a single or
small group of software developers, which looks blurry to an outsider, since analysis
and design phases are not clearly defined. It consists of the following:
77
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
78
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
• The extends relationship is used when you have one use case that is similar to
another use case but does a bit more .It extends the functionality of the original use
case.
• The uses relationship senses common behavior in different use cases.
Use cases could be viewed as concrete or abstract.
• An abstract use case is not complete and has no actors that initiate it but is used
by another use case .This inheritance could be in several levels.
• Abstract use cases are the ones that have uses or extend relationships.
Fig 5.8
5.2 .2 Architecture
System development includes development of different models. We need to
find modeling technique notation for each model. Such a set of modeling techniques
defines the architecture. Each model shows certain aspects of the system. Collection
of models is known as architecture.
79
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
which a system actually is used. By organizing the analysis and design models around
sequences of user interaction and actual usage scenarios, the method produces
systems that are both usable and more robust adapting more easily to changing usage.
Objectory has been developed and applied to numerous application areas and
embodied in CASE tool systems.
80
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
model. The analysis process is iterative but requirements and analysis model should
be stable before moving on to subsequent models. Prototyping is also useful.
• Design and Implementation Phases: Implementation environment should be
identified for design model. The various factors affecting the design model are
DBMS, distribution of process, constraints due to programming language, available
component libraries and incorporation of GUI. It may be possible to identify
implementation environment concurrently with analysis. The analysis objects are
translated into design objects that fit current implementation environment.
• Testing Phase: It describes testing, levels and techniques (unit, integration and
system.)
What is UML?
UML stands for Unified Modeling Language. This object-oriented system of notation
has evolved from the work of Grady Booch, James Rumbaugh, Ivar Jacobson, and the
Rational Software Corporation. These renowned computer scientists fused their
respective technologies into a single, standardized model. Today, UML is accepted by
the Object Management Group (OMG) as the standard for modeling object oriented
programs. The primary goals in the design of the UML were as follows:
1. Provide users a ready to use expressive visual modeling language so they can
develop and exchange meaningful models.
81
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
UML defines nine types of diagrams: Class (package), Object, Use case, Sequence,
Collaboration, State chart, Activity, Component, and Deployment.
Fig 5.9
Active Class
Active classes initiate and control the flow of activity, while passive classes store data
and serve other classes. Illustrate active classes with a thicker border.
Fig 5.10
Visibility
Use visibility markers to signify who can access the information contained within a
class. Private visibility hides information from anything outside the class partition.
Public visibility allows all other classes to view the marked information. Protected
visibility allows child classes to access information they inherited from a parent class.
82
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
fig 5.11
Fig 5.12
Multiplicity(Cardinality)
Place multiplicity notations near the ends of an association. These symbols indicate
the number of instances of one class linked to one instance of the other class. For
example, one company will have one or more employees, but each employee works
for one company only.
83
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Fig 5.13
Constraint
Place constraints inside curly braces {}.
Simple Constraint
Fig 5.14
Composition and Aggregation
84
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
classes are not dependent on each other. The diamond end in both a composition and
aggregation relationship points toward the "whole" class or the aggregate.
Fig 5.15
Generalization
Generalization is another name for inheritance or an "is a" relationship. It refers to a
relationship between two classes where one class is a specialized version of another.
For example, Honda is a type of car. So the class Honda would have a generalization
relationship with the class car.
Fig 5.16
In real life coding examples, the difference between inheritance and aggregation can
be confusing. If you have an aggregation relationship, the aggregate (the whole) can
access only the PUBLIC functions of the part class. On the other hand, inheritance
allows the inheriting class to access both the PUBLIC and PROTECTED functions of
the superclass.
85
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Packages
Use a tabbed folder to illustrate packages. Write the name of the package on the tab or
inside the folder. Similar to classes, you can also list the attributes of a package.
Fig 5.17
Visibility
Visibility markers signify who can access the information contained within a package.
Private visibility means that the attribute or the operation is not accessible to anything
outside the package. Public visibility allows an attribute or an operation to be viewed
by other packages. Protected visibility makes an attribute or operation visible to
packages that inherit it only.
Fig5.18
Dependency
Dependency defines a relationship in which changes to one package will affect
another package. Importing is a type of dependency that grants one package access to
the contents of another package.
86
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Fig 5.19
fig 5.20
Object attributes
As with classes, you can list object attributes in a separate compartment. However,
unlike classes, object attributes must have values assigned to them.
87
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Fig 5.21
Active object
Objects that control action flow are called active objects. Illustrate these objects with
a thicker border.
Fig 5.22
Multiplicity
You can illustrate multiple objects as one symbol if the attributes of the individual
objects are not important.
Fig 5.23
Links - Links are instances of associations. You can draw a link using the lines used
in class diagrams.
Fig 5.24
88
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Self-linked
Objects that fulfill more than one role can be self-linked. For example, if Mark, an
administrative assistant, also fulfilled the role of a marketing assistant, and the two
positions are linked, Mark's instance of the two classes will be self-linked.
Fig 5.25
Use case diagrams model the functionality of a system using actors and use cases. Use
cases are services or functions provided by the system to its users.
Fig 5.26
Use Case
Draw use cases using ovals. Label with ovals with verbs that represent the system's
functions.
89
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Fig 5.27
Actors
Actors are the users of a system. When one system is the actor of another system,
label the actor system with the actor stereotype.
Fig 5.28
Relationships
Illustrate relationships between an actor and a use case with a simple line. For
relationships among use cases, use arrows labeled either "uses" or "extends." A "uses"
relationship indicates that one use case is needed by another in order to perform a
task. An "extends" relationship indicates alternative options under a certain use case.
90
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Fig 5.29
fig 5.30
Activation
Activation boxes represent the time an object needs to complete a task.
Fig 5.31
Messages - Messages are arrows that represent communication between objects.
Use half-arrowed lines to represent asynchronous messages. Asynchronous
messages are sent from an object that will not wait for a response from the
receiver before continuing its tasks.
91
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Lifelines
Lifelines are vertical dashed lines that indicate the object's presence over time.
Fig 5.34
Destroying Objects
Objects can be terminated early using an arrow labeled "< < destroy > >" that
points to an X.
92
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
fig 5.35
Loops
A repetition or loop within a sequence diagram is depicted as a rectangle. Place
the condition for exiting the loop at the bottom left corner in square brackets [ ].
Fig 5.36
93
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
information taken from class, sequence, and use case diagrams describing both the
static structure and dynamic behavior of a system.
Fig 5.37
Association roles
Association roles describe how an association will behave given a particular
situation. You can draw association roles using simple lines labeled with
stereotypes.
Fig 5.38
Messages
Unlike sequence diagrams, collaboration diagrams do not have an explicit way to
denote time and instead number messages in order of execution. Sequence numbering
can become nested using the Dewey decimal system. For example, nested messages
under the first message are labeled 1.1, 1.2, 1.3, and so on. The condition for a
message is usually placed in square brackets immediately following the sequence
number. Use a * after the sequence number to indicate a loop.
Fig 5.39
94
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
vii) UML State chart Diagram A state chart diagram shows the behavior of classes
in response to external stimuli. This diagram models the dynamic flow of control from
state to state within a system.
Transition
A solid arrow represents the path between different states of an object. Label the
transition with the event that triggered it and the action that results from it.
Fig 5.40
Initial State
A filled circle followed by an arrow represents the object's initial state.
Final State
An arrow pointing to a filled circle nested inside another circle represents the object's
final state.
95
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
fig 5.41
Synchronization and Splitting of Control
A short heavy bar with two transitions entering it represents a synchronization of
control. A short heavy bar with two transitions leaving it represents a splitting of
control that creates multiple states.
Action states
Action states represent the non interruptible actions of objects. You can draw an
action state in SmartDraw using a rectangle with rounded corners.
Action Flow
Action flow arrows illustrate the relationships among action states.
96
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Object Flow
Object flow refers to the creation and modification of objects by activities. An object
flow arrow from an action to an object means that the action creates or influences the
object. An object flow arrow from an object to an action indicates that the action state
uses the object.
Final State
An arrow pointing to a filled circle nested inside another circle represents the final
action state.
Branching
A diamond represents a decision with alternate paths. The outgoing alternates should
be labeled with a condition or guard expression. You can also label one of the paths
"else."
97
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Fig 5.42
Synchronization
A synchronization bar helps illustrates parallel transitions. Synchronization is also
called forking and joining.
fig 5.43
Swimlanes
Swimlanes group related activities into one column.
98
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Fig 5.44
Interface
An interface describes a group of operations used or created by components.
99
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Dependencies
Draw dependencies among components using dashed arrows.
Fig 5.45
Association
Association refers to a physical connection between nodes, such as Ethernet.
100
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
Fig 5.46
REFERENCES
Text Book
101
OBJECT ORIENTED MODELING AND DESIGN DEPT OF COMPUTER SCIENCE & ENGG, SAINTGITS
References
102