object-oriented modeling and design.ppt
TRANSCRIPT
-
8/10/2019 Object-oriented modeling and design.ppt
1/159
Ajay Tripathi 1
Object-oriented modeling and
design
-
8/10/2019 Object-oriented modeling and design.ppt
2/159
Ajay Tripathi 2
Introduction
It is a new way of thinking about problems
using models based on real world concepts.
The basic construct is object which combines
both data structure and behavior in a singleentity.
Rambaugh presents an object oriented
software development methodology, the
Object Modeling Technique (OMT) which
extends from analysis through design to
implementation.
-
8/10/2019 Object-oriented modeling and design.ppt
3/159
Ajay Tripathi 3
Analysis model is built to abstract essentialaspects of application domain which containsobjects found in application, their propertiesand behavior.
Then design model is made to describe andoptimize the implementation.
Finally the design model is implemented in a
programming language, database orhardware.
Graphical notation is used for expressingobject-oriented models.
-
8/10/2019 Object-oriented modeling and design.ppt
4/159
Ajay Tripathi 4
What is object-oriented?
Software is organized as a collection of
discrete objects that incorporate both data
structure and behavior.
In general it includes- identity, classification,polymorphism and inheritance.
Object Oriented Programming Language
= Object Based Programming Language(e.g.'83 Ada and Modula-2)
+ Inheritance + Dynamic Binding
-
8/10/2019 Object-oriented modeling and design.ppt
5/159
Ajay Tripathi 5
Identity
Identity means that data is organized into
discrete, distinguishable entities called objects.
Objects can be concrete or conceptual.
In real world an object simply exist but within aprogramming language each object has a
unique handle by which it can be uniquely
referenced.
The handle can be implemented by address,
array index or unique value of an attribute.
-
8/10/2019 Object-oriented modeling and design.ppt
6/159
Ajay Tripathi 6
Classification
It means that objects with same data
structure (attribute) and behavior
(operations) are grouped into a class.
A class is an abstraction that describes
important properties and ignores the
rest.
-
8/10/2019 Object-oriented modeling and design.ppt
7/159
Ajay Tripathi 7
Polymorphism
It means that the same operation (i.e.
action or transformation that the object
performs) may behave differently on
different classes.
Specific implementation of an operation
by a certain class is called a method.
-
8/10/2019 Object-oriented modeling and design.ppt
8/159
Ajay Tripathi 8
Inheritance
It is the sharing of attributes and
operations among classes based on a
hierarchical relationship.
Subclasses can be formed from broadly
defined class.
Each subclass incorporates or inherits all
the properties of its super class and adds
its own unique properties.
-
8/10/2019 Object-oriented modeling and design.ppt
9/159
Ajay Tripathi 9
Object-oriented development?
The theme is the identification and
organization of application concepts rather
than final representation in a prog. Language.
OOD approach encourages softwaredevelopers to work and think in terms of the
application domain through most of the
software engineering life cycle.
It is a conceptual process independent of a
programming language until the final stage.
-
8/10/2019 Object-oriented modeling and design.ppt
10/159
Ajay Tripathi 10
Object-oriented methodology
Stages-
Analysis
System design Object design
implementation
-
8/10/2019 Object-oriented modeling and design.ppt
11/159
Ajay Tripathi 11
3 models
Object model
Dynamic model
Functional model
-
8/10/2019 Object-oriented modeling and design.ppt
12/159
Ajay Tripathi 12
Object model
Describes basic structure of objects and
their relationship
Contains object diagram
Object diagram is a graph whose nodes
are object classes (Classes) and whose
arcs are relationships among classes.
-
8/10/2019 Object-oriented modeling and design.ppt
13/159
Ajay Tripathi 13
Dynamic model
Describes the aspects of a system that
change over time.
It specifies and implement control
aspects of a system.
Contains state diagram.
State diagram is a graph whose nodesare states and whose arcs are data-
flows.
-
8/10/2019 Object-oriented modeling and design.ppt
14/159
Ajay Tripathi 14
Functional Model
Describes data value transformation
within a system.
Contains data flow diagram.
Data Flow Diagram is a graph whose
nodes are processes and whose arcs
are data flows.
-
8/10/2019 Object-oriented modeling and design.ppt
15/159
Ajay Tripathi 15
Object-Oriented concepts
Abstraction
Encapsulation
Combining data and behavior Sharing
Object structure, not Procedure Structure
Synergy
-
8/10/2019 Object-oriented modeling and design.ppt
16/159
Ajay Tripathi 16
Abstraction
It consists of focusing on essential aspects of an entity andignoring accidental properties.
The goal is to isolate those aspects that are important for somepurpose and suppress those aspects that are unimportant.
Abstraction must always for some purpose because the purposedetermines what is and what is not important.
Many different abstractions of same thing are possible,depending on the purpose for which they are made.
In building models, one must not search for absolute truth but foradequacy for some purpose.
A good model captures the crucial aspects of a problem and
omits the others. Focus on what an object is and does, not how to implement.
-
8/10/2019 Object-oriented modeling and design.ppt
17/159
Ajay Tripathi 17
-
8/10/2019 Object-oriented modeling and design.ppt
18/159
Ajay Tripathi 18
Encapsulation
Information hiding
Separating external aspects of an objectwhich are accessible to other objects,
from the internal implementation detailsof the object, which are hidden fromother objects.
The implementation of an object can bechanged without affecting theapplications that use it.
-
8/10/2019 Object-oriented modeling and design.ppt
19/159
Ajay Tripathi 19
-
8/10/2019 Object-oriented modeling and design.ppt
20/159
Ajay Tripathi 20
Synergy
Identity, Classification, polymorphism
and inheritance can be used in isolation
but together they complement each other
synergistically.
-
8/10/2019 Object-oriented modeling and design.ppt
21/159
Ajay Tripathi 21
Advantages of OOD
Used in developing Compilers, Graphics, UI,databases, Object oriented languages, CADsystems, simulations, etc.
Used to document existing programs that areill-structured and difficult to understand.
Not reduces development time; it may takemore time than conventional development
because it is intended to promote future reuseand reduce downstream errors andmaintenance.
-
8/10/2019 Object-oriented modeling and design.ppt
22/159
Ajay Tripathi 22
Modeling
A model is an abstraction of somethingfor the purpose of understanding it
before building it.
The word model has 2 dimensions- aview of a system ( object, dynamic or
functional) and a stage of development (
analysis, design or implementation)
-
8/10/2019 Object-oriented modeling and design.ppt
23/159
Ajay Tripathi 23
Purpose
Testing a physical entity before building
it
Communication with customers
Visualization
Reduction of complexity
-
8/10/2019 Object-oriented modeling and design.ppt
24/159
Ajay Tripathi 24
Object Modeling
Captures static structure of a system-
Objects in the system
Attributes operations
-
8/10/2019 Object-oriented modeling and design.ppt
25/159
Ajay Tripathi 25
Objects
Define objects as a concept, abstraction
or thing with purposeful meaning.
Two purpose of objects-
Promote understanding of the real world
Provide a practical basis for computer
implementation.
All objects have identity and are
distinguishable.
-
8/10/2019 Object-oriented modeling and design.ppt
26/159
-
8/10/2019 Object-oriented modeling and design.ppt
27/159
Ajay Tripathi 27
Classes
An object class describes a group of
objects with similar properties
(attributes), common behavior
(operations), common relationships toother objects and common semantics.
-
8/10/2019 Object-oriented modeling and design.ppt
28/159
Ajay Tripathi 28
Object diagram
It provides a formal graphic notation for
modeling objects, classes and their
relationships to one another.
Types-
Class diagram
Instance diagram
-
8/10/2019 Object-oriented modeling and design.ppt
29/159
-
8/10/2019 Object-oriented modeling and design.ppt
30/159
Ajay Tripathi 30
Instance diagram
Describes how a particular set of objects
relate to each other.
Describes objects
-
8/10/2019 Object-oriented modeling and design.ppt
31/159
Ajay Tripathi 31
Person
Class Diagram
(Person)
Ram
(Person)
Jai
(Person)
Instance Diagram
-
8/10/2019 Object-oriented modeling and design.ppt
32/159
-
8/10/2019 Object-oriented modeling and design.ppt
33/159
Ajay Tripathi 33
Object Modeling Notations
Person
name: string
age: integer
Class with Attributes
(Person)
Ram
24
(Person)
Jai
34
Objects with Values
-
8/10/2019 Object-oriented modeling and design.ppt
34/159
Ajay Tripathi 34
Operations and Methods
An operation is a function or transformationthat may be applied to or by objects in a class.
All objects in a class share the sameoperations.
The same operation may apply to manydifferent classes.
Such an operation is polymorphic i.e. the
same operation takes on different forms indifferent classes.
A method is the implementation of anoperation for a class.
-
8/10/2019 Object-oriented modeling and design.ppt
35/159
Ajay Tripathi 35
Person
name
age
change-job
change-add
Person
name
age
change-job
change-add
Person
name
age
print
File
name
size
Operations
-
8/10/2019 Object-oriented modeling and design.ppt
36/159
-
8/10/2019 Object-oriented modeling and design.ppt
37/159
Ajay Tripathi 37
Associations are bidirectional.
In real, both directions of traversal are equally
meaningful and refer to same association.
Associations are often implemented inprogramming languages as pointers from one
object to another.
A pointer is an attribute in one object that
contains an explicit reference to another
object.
-
8/10/2019 Object-oriented modeling and design.ppt
38/159
Ajay Tripathi 38
A link shows a relationship between two
or more objects.
All connections among classes should
be modeled as association.
One-to-one association
Many-to-many association
Ternary association
-
8/10/2019 Object-oriented modeling and design.ppt
39/159
-
8/10/2019 Object-oriented modeling and design.ppt
40/159
-
8/10/2019 Object-oriented modeling and design.ppt
41/159
Ajay Tripathi 41
Project Language
Person
(Project)
MIS
(Language)
.Net
(Project)CAD
(Language)C
(Person)
Jai
Ternary Association and Links
-
8/10/2019 Object-oriented modeling and design.ppt
42/159
Ajay Tripathi 42
Multiplicity
It specifies how many instances of one
class may relate to a single instance of an
associated class.
In OMT solid ball -> zero or more
Hollow ball -> optional (zero or one)
Multiplicity depends upon assumptions
and how you define the boundaries of a
problem.
-
8/10/2019 Object-oriented modeling and design.ppt
43/159
Ajay Tripathi 43
Link attributes
An link attribute is a property of the links
in an association.
Accessible By
-
8/10/2019 Object-oriented modeling and design.ppt
44/159
Ajay Tripathi 44
File UserAccessible By
Access permission
/etc/temp read Ram
/etc/temp read-write Mohan
/usr/lgn read-write Shyam
Link Attributes for a many-to-many association
-
8/10/2019 Object-oriented modeling and design.ppt
45/159
Ajay Tripathi 45
Person
name
ssn
address
Company
Name
address
Works-for
SalaryJob-title
Performance rating
boss
manages
worker
Link attributes for one-to-many associations
-
8/10/2019 Object-oriented modeling and design.ppt
46/159
Ajay Tripathi 46
Modeling an Association as a Class
Each link becomes one instance of the
class.
Authorized on
-
8/10/2019 Object-oriented modeling and design.ppt
47/159
Ajay Tripathi 47
User WorkstationAuthorized on
Authorization
Priority
PrivilegesStart session
Directory
Home directory
Modeling an association as a class
-
8/10/2019 Object-oriented modeling and design.ppt
48/159
Ajay Tripathi 48
Role Names
A role is one end of an association.
A binary association has 2 roles, each ofwhich may have a role name.
A role name is a name that uniquely identifiesone end of an association.
Roles often appear as nouns in problemdescriptions.
Use of role name is optional. Role names are necessary for associations
between two objects of the same class.
-
8/10/2019 Object-oriented modeling and design.ppt
49/159
Ajay Tripathi 49
person companyemployee employer
Works-for
Employee Employer
Ram TCS
Mohan Wipro
Role names for an association
-
8/10/2019 Object-oriented modeling and design.ppt
50/159
Ajay Tripathi 50
ordering
If order of objects required
Indicated by writing {ordered} next to
multiplicity dot for the role.
window screen{ordered}
Visible-on
Ordered sets in an association
-
8/10/2019 Object-oriented modeling and design.ppt
51/159
Ajay Tripathi 51
Qualification
It relates two classes and a qualifier.
Qualifier is a special attribute that reduces theeffective multiplicity of an association.
One-to-many or many-to-many may bequalified that can be reduced to one-to-one. (but not always)
It 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.
-
8/10/2019 Object-oriented modeling and design.ppt
52/159
Ajay Tripathi 52
Directory FileFile name
A qualified association
A directory plus a file name yields a file
-
8/10/2019 Object-oriented modeling and design.ppt
53/159
Ajay Tripathi 53
Company office Personorganization
officer
-
8/10/2019 Object-oriented modeling and design.ppt
54/159
-
8/10/2019 Object-oriented modeling and design.ppt
55/159
Ajay Tripathi 55
document paragraph sentence
Aggregation
-
8/10/2019 Object-oriented modeling and design.ppt
56/159
Ajay Tripathi 56
Aggregation
It is a form of association in which an
aggregate object is made of
components.
Components are part of aggregate.
Aggregate is inherently transitive i.e. an
aggregate has parts which may in turn
have parts.
-
8/10/2019 Object-oriented modeling and design.ppt
57/159
-
8/10/2019 Object-oriented modeling and design.ppt
58/159
-
8/10/2019 Object-oriented modeling and design.ppt
59/159
G
-
8/10/2019 Object-oriented modeling and design.ppt
60/159
Ajay Tripathi 60
Generalization
It is a relationship between base class
and sub class.
It is is-a relationship because each
instance of a sub class is an instance ofsuper class as well.
FigureColor
-
8/10/2019 Object-oriented modeling and design.ppt
61/159
Ajay Tripathi 61
Pos
Thickness
Move
Select
Displayrotate
0 D 1 D 2 D
Point Line Arc Spline circlePolygon
Inheritance for graphic figure
A ti G li ti
-
8/10/2019 Object-oriented modeling and design.ppt
62/159
Ajay Tripathi 62
Aggregation vs. Generalization
Aggregation relates instances.
Two distinct objects are involved; one of themis a part of the other.
Generalization relates classes. Aggregation is often called a part of
relationship; generalization is often called akind-of or is-a relationship.
Aggregation is sometimes called an andrelationship and generalization refers to orrelationship
-
8/10/2019 Object-oriented modeling and design.ppt
63/159
Ajay Tripathi 63
lamp
base cover switch wiring
incandescentfluorescent
part4part3part2part1
Aggregation and generalization
-
8/10/2019 Object-oriented modeling and design.ppt
64/159
Ajay Tripathi 64
Aggregation can be fixed, variable or
recursive.
A fixed aggregate has a fixed structure;
the number and types of sub parts arepredefined e.g. lamp.
A variable aggregation has a finite
number of levels but number of partsmay vary e.g. company.
-
8/10/2019 Object-oriented modeling and design.ppt
65/159
Ajay Tripathi 65
A recursive aggregation contains directly
or indirectly an instance of the same kind
of aggregate; the number of potential
levels is unlimited e.g. computerprogram.
-
8/10/2019 Object-oriented modeling and design.ppt
66/159
P ti f ti
-
8/10/2019 Object-oriented modeling and design.ppt
67/159
Ajay Tripathi 67
Propagation of operations
Propagation (triggering) is automatic
application of an operation to a network
of objects when the operation is applied
to some starting object. E.g. moving an aggregation moves its
parts; the move operation propagates to
the parts.
-
8/10/2019 Object-oriented modeling and design.ppt
68/159
Ajay Tripathi 68
A person owns multiple documents.Each document is composed ofparagraphs that are in turn composed of
characters. The copy operationpropagates from documents toparagraphs to characters. Copying aparagraph copies all the characters in it.
The operation does not propagate inreverse direction.
-
8/10/2019 Object-oriented modeling and design.ppt
69/159
Ajay Tripathi 69
Propagation can be possible for save,
destroy, print and lock.
Person Document
copy
Paragraph
copy
Character
copyowns
copy copy
Propagation of operations
Ab t t l
-
8/10/2019 Object-oriented modeling and design.ppt
70/159
Ajay Tripathi 70
Abstract classes
An abstract class is a class that has nodirect instances but whose descendentclasses have direct instances.
A concrete class is a class that isinstantiable i.e. it can have directinstances.
A concrete class may have abstractsubclasses but they must have concretedescendents.
-
8/10/2019 Object-oriented modeling and design.ppt
71/159
Ajay Tripathi 71
only concrete classes may be leaf
classes in the inheritance tree.
Ab t t & t l
-
8/10/2019 Object-oriented modeling and design.ppt
72/159
Ajay Tripathi 72
Abstract & concrete class
class
concrete abstractinstance
Leaf classNon leaf class
subclass
1+ 1+
subclass
Has subclasses
Has subclasses
superclass
superclass
Direct
instances
-
8/10/2019 Object-oriented modeling and design.ppt
73/159
-
8/10/2019 Object-oriented modeling and design.ppt
74/159
Ajay Tripathi 74
Abstract class & abstract operation
EmployeeEarning
Pay {abstract}
SLRD Employee
Earning
pay
HNRY Employee
Earning
pay
HRLY Employee
Earning
pay
-
8/10/2019 Object-oriented modeling and design.ppt
75/159
-
8/10/2019 Object-oriented modeling and design.ppt
76/159
Ajay Tripathi 76
ExtensionThe new operation is same as inherited except it adds somebehavior usually affecting new attributes of the subclass.
Restriction
The new operation restricts the inherited.
Optimization
The new method must have the same external protocol(prototype) and results as the old one but its internalrepresentation and algorithm may differ completely.
Convenience
The new class is made a subclass of the existing class and
overrides the methods that are inconvenient.
Multiple inheritance
-
8/10/2019 Object-oriented modeling and design.ppt
77/159
Ajay Tripathi 77
Multiple inheritance
It permits to have more than one super classand to inherit features from all parents.
A class with more than one super class is
called a join class. A feature from the ancestor class found along
more than one path is inherited only once.
Conflicts among parallel definitions create
ambiguities that must be resolved in
implementation.
-
8/10/2019 Object-oriented modeling and design.ppt
78/159
Ajay Tripathi 78
vehicle
WatervehicleLandvehicle
boatamphibiousvehiclecar
Multiple inheritance from overlapping classes
[ join class ]
Overlapping Classes
-
8/10/2019 Object-oriented modeling and design.ppt
79/159
Ajay Tripathi 79
A hollow triangle indicates disjointsubclasses while a solid triangle
indicates overlapping subclasses.
-
8/10/2019 Object-oriented modeling and design.ppt
80/159
-
8/10/2019 Object-oriented modeling and design.ppt
81/159
-
8/10/2019 Object-oriented modeling and design.ppt
82/159
Ajay Tripathi 82
Person
NameAge
weight
(Person)
Name=ABC
Age=40
Weight=40
(Person)
Name=XYZ
Age=29
Weight=70
Notation for instantiation
Class descriptors
-
8/10/2019 Object-oriented modeling and design.ppt
83/159
Ajay Tripathi 83
Class descriptors
Classes are meta objects and not real world objects. Class descriptors have features and they have their
own classes which are called meta classes.
A class attribute describes a value common to anentire class of objects rather than data particular to
each instance. Class attributes are useful for storing default
information for creating new objects or summaryinformation about instances of the class.
A class operation is an operation on the class itself.
The most common is to create new instances. Operations on class structure are class operations.
Class descriptors
-
8/10/2019 Object-oriented modeling and design.ppt
84/159
Ajay Tripathi 84
Class descriptors
Window
Size:rectangle
Visibility:boolean
Default_size:rectangle
Display
New_window
Highest_priority_window
-
8/10/2019 Object-oriented modeling and design.ppt
85/159
constraints
-
8/10/2019 Object-oriented modeling and design.ppt
86/159
Ajay Tripathi 86
constraints
These are functional relation betweenentities of an object model.
Entity includes objects, classes,
attributes, links and associations.A constraint restricts the values that
entities can assume.
Simple constraints may be placed inobject models and complex may be infunctional model.
-
8/10/2019 Object-oriented modeling and design.ppt
87/159
General constraints
-
8/10/2019 Object-oriented modeling and design.ppt
88/159
Ajay Tripathi 88
General constraints
It must be expressed with naturallanguages or equations.
Draw a dotted line between classes
involved in the constraint and specify thedetails with comments in braces.
Person Committee
Member_of
Chair_of{subset }
Derived objects links and attributes
-
8/10/2019 Object-oriented modeling and design.ppt
89/159
Ajay Tripathi 89
Derived objects, links and attributes
The notation for a derived entity is aslash or diagonal line on the corner of a
class box, on an association line or in
front of an attribute. Show the constraint that determines the
derived value. (optional)
PersonBirthdate
/age
Current date
{ age = currentdatebirthdate }
-
8/10/2019 Object-oriented modeling and design.ppt
90/159
Homomorphism
-
8/10/2019 Object-oriented modeling and design.ppt
91/159
Ajay Tripathi 91
Homomorphism
It maps between two associations.
catalogItemModel#
ItemSl#
containscontainsMaps
Describes
{ item 1 contains item 2 => item1.model contains item2.model }
Homomorphism for a parts catalog
-
8/10/2019 Object-oriented modeling and design.ppt
92/159
Ajay Tripathi 92
In general, a homomorphism involves 4relationships among 4 classes.
The homomorphism maps links of one general
association {u} into links of another generalassociation {t} as a many-to-one mapping.
Two instantiationrelationships map elements
of one class into another:
r is a many-to-one mapping from class B to A and
s is a many-to-one mapping from class D to C.
-
8/10/2019 Object-oriented modeling and design.ppt
93/159
Ajay Tripathi 93
A
C
B
D
r
s
t u
{u ( b, d)=>t ( b.r, d.s ) }
General Homomorphism
-
8/10/2019 Object-oriented modeling and design.ppt
94/159
Ajay Tripathi 94
In general where t is on a single classand u is on a single class then A=C, B=D
and r=s.
Homomorphism is a special type ofrelationship between relationships.
Dynamic Modeling
-
8/10/2019 Object-oriented modeling and design.ppt
95/159
Ajay Tripathi 95
Dynamic Modeling
First examine the system at a single moment of time. Then examine changes to objects and their
relationships over time.
Those aspects of a system that are concerned with
time and changes are dynamic model, in contrast withstatic or object model.
Control is the aspect of a system that describes thesequences of operations that occur in response toexternal stimuli without considering what the operation
do, what they operate on, and how they areimplemented.
concepts
-
8/10/2019 Object-oriented modeling and design.ppt
96/159
Ajay Tripathi 96
concepts
Eventsrepresent external stimuli
Statesvalues of objects
State diagram
Events
-
8/10/2019 Object-oriented modeling and design.ppt
97/159
Ajay Tripathi 97
Events
It is something that happens at a point in time One event may logically precede or follow
another or the two events may be unrelated.
The two events are casually related.
The two events are casually unrelated are saidto be concurrent i.e. they have no effect oneach other.
In modeling a system we do not establish anordering between concurrent events becausethey can occur at any order.
-
8/10/2019 Object-oriented modeling and design.ppt
98/159
Ajay Tripathi 98
An event is a one-way transmission ofinformation from one object to another.
In real world, all objects exist
concurrently.An object sending an event to another
object may expect a reply but the reply isa separate event under the control of the
second object which may or may notchoose to send it.
-
8/10/2019 Object-oriented modeling and design.ppt
99/159
Ajay Tripathi 99
Every event is a unique occurrence, but we groupthem into event classes and give each event class aname to indicate common structure and behavior.
This structure is hierarchical as class structure.
E.g. flight 123 departs from Delhi and flight 321departs from Rome are instances of event classairplane flight departs having attributes airline flight no,city.
The time at which an event occurs is an implicit
attribute of all events.
-
8/10/2019 Object-oriented modeling and design.ppt
100/159
-
8/10/2019 Object-oriented modeling and design.ppt
101/159
Scenarios and event traces
-
8/10/2019 Object-oriented modeling and design.ppt
102/159
Ajay Tripathi102
Scenarios and event traces
A scenario is a sequence of events that occursduring one particular execution of a system.
The scope of a scenario can vary; it may
include all events in the system or it mayinclude only those events generated by certain
objects in the system.
It can be the historical record of executing a
system or a thought experiment of executing aproposed system.
Caller lifts receiver
Dial tone begins
-
8/10/2019 Object-oriented modeling and design.ppt
103/159
Ajay Tripathi103
Dial tone begins
Caller dials digit (5)
Dial tone ends
Caller dials digit (5)Caller dials digit (4)
Caller dials digit (3)
Caller dials digit (2)
Caller dials digit (1)
Called phone begins ringing
Ringing tone appears in calling phoneCalled party answers
Called phone stops ringing
Ringing tone disappears in calling phone
Phones are connected
Called party hangs up
Phones are disconnectedCaller hangs up
Scenario for phone call
-
8/10/2019 Object-oriented modeling and design.ppt
104/159
Ajay Tripathi104
The next step after writing scenario is to identify thesender and receiver objects of each event.
The sequence of events and the objects exchangingevents are shown in event trace diagram.
This diagram shows each object as a vertical line andeach event as a horizontal arrow from the sender toreceiver objects.
Time increases from top to bottom.
Sequences of events are shown not their exact timing.
Event trace for phone call
-
8/10/2019 Object-oriented modeling and design.ppt
105/159
Ajay Tripathi105
e t t ace o p o e ca
Caller phone line calleeCaller lifts receiver
Dial tone begins
Caller dials digit (5)
Dial tone ends
Caller dials digit (5)
Caller dials digit (4)
Caller dials digit (3)Caller dials digit (2)
Caller dials digit (1)
Called phone begins ringing phone rings
answer phone
ringing stops ringing stops
phones are connected phones connected
Callee hangs up
disconnected disconnected
Caller hangs up
States
-
8/10/2019 Object-oriented modeling and design.ppt
106/159
Ajay Tripathi106
It is an abstraction of the attribute values and links ofan object.
Set of values are grouped together into a stateaccording to properties that affect the gross behaviorof the object e.g. the state of bank is either solvent orinsolvent whether its assets are greater than liabilities.
A state specifies the response of the object to inputevents.
Response is same for all values within the same state
and may be different for values in different states. Response of an object to an event may include an
action or change of states by the object.
-
8/10/2019 Object-oriented modeling and design.ppt
107/159
Ajay Tripathi107
A state has duration
An event separates two states and a
state separates two events.
In defining states we ignore thoseattributes that do not affect the behavior
of the objects.
-
8/10/2019 Object-oriented modeling and design.ppt
108/159
-
8/10/2019 Object-oriented modeling and design.ppt
109/159
Ajay Tripathi109
idle
Timed- out
disconnected
Busy tone
Fast busy tone
Dial tone
dialing
connecting
ringing
connected
Recorded message
On-hookOn-hook
Off-hook
Digit(n)
Invalid no
valid
routed
Called phone answers
Called phone hangs up
Trunk busy
Num busy
State diagram for phone line
-
8/10/2019 Object-oriented modeling and design.ppt
110/159
Ajay Tripathi110
A state diagram describes the behavior of asingle class.
Since all instances of a class have samebehavior they all share the same state
diagram as they all share the same classfeatures.
But as each object has its own attribute valuesso each object has its own state.
Each object is independent of the otherobjects and proceeds as its own pace.
Conditions
-
8/10/2019 Object-oriented modeling and design.ppt
111/159
Ajay Tripathi111
A condition is a Boolean function ofobject values.
When Ram goes out in morning( event),
if the temperature is below freezing(condition), then he puts on his gloves
(next state).
Notation is [condition]
Operations
-
8/10/2019 Object-oriented modeling and design.ppt
112/159
Ajay Tripathi112
p
An activity is an operation that takes time to complete. An activity is associated with a state.
Notation do:A within a state box indicates that activity A startson entry to the state and stops on exit.
An action is an instantaneous operation.
An operation is associated with an event.
An action represents an operation whose duration is insignificantcompared to the state diagram e.g. disconnect phone line mightbe an action in response to an on_hook event for phone line.
Actions can also represent internal control operations such assetting attributes or generating other events.
The notation for an action is (/) and the name of action, followingthe name of the event that causes it.
Action for pop-up menu
-
8/10/2019 Object-oriented modeling and design.ppt
113/159
Ajay Tripathi113
p p p
idle Menu visible
Right button down/display menu
Right button up/erase menu
Cursor moved/highlight menu item
-
8/10/2019 Object-oriented modeling and design.ppt
114/159
Ajay Tripathi114
State1
do:activity1
State2
do:activity1
Event1 (attributes)[condition1]/action1
Sate generalization
-
8/10/2019 Object-oriented modeling and design.ppt
115/159
Ajay Tripathi115
g
A nested state diagram is a form ofgeneralization on states.
Generalization is or-relation.
States may have sub states that inheritthe transitions of their super states just
as classes have subclasses that inherit
the attributes and operations of theirsuper classes.
Aggregation and its concurrent state
diagram
-
8/10/2019 Object-oriented modeling and design.ppt
116/159
Ajay Tripathi116
diagramCar
Ignition Transmission Brake Accelerator
Ignition
off starting on
Turn key to
start[Transmission
in Neutral] Released Key
Turn key off
Sate of car transmission with
generalization
-
8/10/2019 Object-oriented modeling and design.ppt
117/159
Ajay Tripathi117
generalization
Transmission
Neutral Reverse
Push R
Push N
Forward
First Second Thirdupshift upshift
downshift downshift
Stop
Push N Push F
-
8/10/2019 Object-oriented modeling and design.ppt
118/159
Ajay Tripathi118
Accelerator
Off Onpress
Release
Accelerator
Off
Brake
Off On
press
Release
-
8/10/2019 Object-oriented modeling and design.ppt
119/159
-
8/10/2019 Object-oriented modeling and design.ppt
120/159
Ajay Tripathi 120
It specifies the results of a computationwithout specifying how or when they arecomputed.
It specifies the meaning of operations inobject model and actions in dynamicmodel as well as constraints in objectmodel.
Functional model exists wheretransformation is a key factor.
DFD
-
8/10/2019 Object-oriented modeling and design.ppt
121/159
Ajay Tripathi 121
It shows the functional relationships of thevalues computed by a system, including input
values, output values and internal data stores.
A DFD 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.
It does not show control information like time,etc.
-
8/10/2019 Object-oriented modeling and design.ppt
122/159
Data Stores
-
8/10/2019 Object-oriented modeling and design.ppt
123/159
Ajay Tripathi 123
It is a passive object within the graph thatstores data.
It does not generate any operation but merelyresponds to requests to store and accessdata.
It is drawn as a pair of parallel lines containingthe name of the store.
Input arrows indicate information or operationsthat modify the stored data.
Output arrows indicate information retrievedfrom data store.
In general data store is implemented as a file.
Data store for temprature readings..
-
8/10/2019 Object-oriented modeling and design.ppt
124/159
Ajay Tripathi 124
Readings
Max temp
Min temp
Data store for bank account
-
8/10/2019 Object-oriented modeling and design.ppt
125/159
Ajay Tripathi 125
Customer withdrawl -
Account
balance
Double headed arrow indicates that balance is both an i/p and o/p of
Subtract operation.
Data store for price list for items
-
8/10/2019 Object-oriented modeling and design.ppt
126/159
Ajay Tripathi 126
Price listItem_name
cost
Find costItem namecost
-
8/10/2019 Object-oriented modeling and design.ppt
127/159
Ajay Tripathi 127
A data flow that generates an objectused as the target of another operation is
indicated by a hollow triangle at the end
of data flow.
BankAccountselectaccounts
Customer
nameupdate
request
balance
( i/p and o/p)
Selection with an object as result
-
8/10/2019 Object-oriented modeling and design.ppt
128/159
Ajay Tripathi 128
Creation of new object
Create account Bankaccount
AccountCustomer
Name, deposit
account
Nested DFD
-
8/10/2019 Object-oriented modeling and design.ppt
129/159
Ajay Tripathi 129
The nesting of a diagram is also calledleveling.
A process can be expanded into another
DFD.
-
8/10/2019 Object-oriented modeling and design.ppt
130/159
-
8/10/2019 Object-oriented modeling and design.ppt
131/159
Ajay Tripathi 131
A control flow is a Boolean value thataffects whether a process is evaluated or
not.
It is shown by a dotted line from aprocess producing a Boolean value to
the process being controlled.
-
8/10/2019 Object-oriented modeling and design.ppt
132/159
Ajay Tripathi 132
customer update
verify
Account
password
amount
cash
Coded password
Password
OK
balance
Specifying Operations
-
8/10/2019 Object-oriented modeling and design.ppt
133/159
Ajay Tripathi 133
Each operation may be specified as- Mathematical functions
Table of input and output values.
Equations Pre and post conditions
Decisions tables
Pseudo code, etc
-
8/10/2019 Object-oriented modeling and design.ppt
134/159
-
8/10/2019 Object-oriented modeling and design.ppt
135/159
Ajay Tripathi 135
Operations can be divided into threeparts-
Queries
ActionsActivities
Query
-
8/10/2019 Object-oriented modeling and design.ppt
136/159
Ajay Tripathi 136
A query is an operation that has no sideeffects on externally visible state of any object.
An action is a transformation that has side
effects on the target object or other objects in
the system reachable from the target object.
Actions can be defined by mathematical
equations, decision trees, decision tables, etc.
Activity
-
8/10/2019 Object-oriented modeling and design.ppt
137/159
Ajay Tripathi 137
It is an operation to or by an object thathas duration in time.
It has inherently side effects because of
its extension in time.Activity only make sense for actors.
constraints
-
8/10/2019 Object-oriented modeling and design.ppt
138/159
Ajay Tripathi 138
It shows the relationship between two objects at the
same time (frequency and wavelength )Or betweendifferent values of the same object at different times(no of outstanding shares of mutual fund).
It can appear in each model.
Object constraints specify that some objects dependentirely or partially on other objects.
Dynamic constraints specify relationships among thestates or events of different objects.
Functional constraints specify restrictions on
operations. A constraint between values of an object over time is
called as invariant i.e. it specifies that some functionsof values remain constant over time.
FM Vs OM & DM
-
8/10/2019 Object-oriented modeling and design.ppt
139/159
Ajay Tripathi 139
FM shows what has to be done by asystem.
The object model shows the doers- the
object. DM shows the sequences in which the
operations are performed.
The three models come together in theimplementation of methods.
FM is a guide to the methods.
-
8/10/2019 Object-oriented modeling and design.ppt
140/159
Ajay Tripathi 140
A process is usually implemented as amethod.
Actors and data stores are objects in the
object model. Data flows are values in object model.
-
8/10/2019 Object-oriented modeling and design.ppt
141/159
Ajay Tripathi 141
Relative to functional model the objectmodel shows the structure of the actors,
data store and flows.
Relative to functional model the dynamicmodel shows the sequence in which
processes are performed.
-
8/10/2019 Object-oriented modeling and design.ppt
142/159
Ajay Tripathi 142
Relative to object model the functionalmodel shows the operations on classes
and the arguments of each operations.
Relative to object model the dynamicmodel shows the states of each object
and the operations that are performed as
it receives events and changes state.
-
8/10/2019 Object-oriented modeling and design.ppt
143/159
Ajay Tripathi 143
Relative to dynamic model the functionalmodel shows the definition of actions
and activities that are undefined with
dynamic model. Relative to dynamic model the object
model shows what changes state and
undergoes operations.
-
8/10/2019 Object-oriented modeling and design.ppt
144/159
Data dictionary
-
8/10/2019 Object-oriented modeling and design.ppt
145/159
Ajay Tripathi 145
A paragraph is written that preciselydescribe each class.
Describe the scope of class, any
assumptions, restrictions. It also describes associations, attributes
and operations.
SA/SD and OMT
-
8/10/2019 Object-oriented modeling and design.ppt
146/159
Ajay Tripathi 146
Both support object, dynamic and functionalmodel for a system.
OMT designs are dominated by object
modeling while SA/SD stresses on functional
decomposition.
SA/SD organizes a system around procedures
while OMT organizes a system around real
world objects or conceptual objects that existin users view of the world.
-
8/10/2019 Object-oriented modeling and design.ppt
147/159
Ajay Tripathi 147
SA/SD is useful for problems where functionsare more important and complex than data.
SA/SD design has a clearly defined systemboundary across which the software
procedures must communicate with the realworld. so it can be difficult to extend a SA/SDdesign to a new boundary.
It is much easier to extend object oriented
design; one merely design adds objects andrelationships.
-
8/10/2019 Object-oriented modeling and design.ppt
148/159
Ajay Tripathi 148
In SA/SD the decomposition of a process intosub process is somewhat arbitrary.
Different people will produce different
decomposition.
In OMT the decomposition is based on objects
in problem domain, so developers of different
programs in same domain tend to discover
similar objects. This increases reusability ofcomponents from one project to the next.
-
8/10/2019 Object-oriented modeling and design.ppt
149/159
Ajay Tripathi 149
An OMT approach better integratesdatabase with programming code.
Object oriented database may improvethe situation.
In contrast, SA/SD is inherently awkwardat dealing with databases. It is difficult tomerge programming code organized
about functions with database organizedwith data.
-
8/10/2019 Object-oriented modeling and design.ppt
150/159
Jackson Structured Development(JSD )
-
8/10/2019 Object-oriented modeling and design.ppt
151/159
Ajay Tripathi 151
Developed by Michael Jackson Popular in Europe.
It does not distinguish between analysis anddesign rather lumps both phases together as
specification. It first determine what and then how
It is useful for application where timing isimportant.
It is less graphical oriented than SA/SD andOMT.
-
8/10/2019 Object-oriented modeling and design.ppt
152/159
Ajay Tripathi 152
JSD model describes the real world interms of entities, action and ordering of
actions.
Entities usually appear as nouns inrequirements statements and actions
appear as verbs.
JSD consists of six sequential steps-
-
8/10/2019 Object-oriented modeling and design.ppt
153/159
Ajay Tripathi 153
Entity action Entity structure
Initial model
Function
System timing
implementation
Entity action
-
8/10/2019 Object-oriented modeling and design.ppt
154/159
Ajay Tripathi 154
The software developer lists entities andactions for part of real world.
The purpose is to guide the choice of
entities and actions for overall system. The input to this step is requirement
statement
The output is list of entities and actions.
-
8/10/2019 Object-oriented modeling and design.ppt
155/159
Ajay Tripathi 155
The entity structure step partially ordersthe actions of each entity by time.
The initial model step states how the realworld connects to the abstract model.
The function step uses pseudo code tostate outputs of actions.
At the end of this step the developer has
a complete specification of requiredsystem.
-
8/10/2019 Object-oriented modeling and design.ppt
156/159
Ajay Tripathi 156
The system timing step considers howmuch the model is permitted to gap the
real world.
The implementation step focuses on theproblems of processes scheduling and
allocates processors to processes.
JSD and OMT
-
8/10/2019 Object-oriented modeling and design.ppt
157/159
Ajay Tripathi 157
JSD is more obscure than data flow andobject-oriented approaches.
One reason for this is its reliance on
pseudo codes; graphical models areeasier to understand.
It is also complex because it was
specifically designed to handle difficultreal time problems
-
8/10/2019 Object-oriented modeling and design.ppt
158/159
JSD is ill suited for applications like-
-
8/10/2019 Object-oriented modeling and design.ppt
159/159
High level analysis. It is ineffective atabstraction and simplification.
Databses. It is biased towards actionsand away from entities and attributes. Itis poor technique for database design.
Conventional software running under anoperating system. Its abstraction of
hundreds or thousands of processes isf i d