Object-Oriented Analysis (OOA)
Object-Oriented Analysis (OOA)
Class-based modeling
CRC models Class diagrams
Behavioral modeling
State diagrams Sequence diagrams
Class Diagrams
Sequence Diagrams
Identifying Responsibilities
4. Essential Requirements objects entities that produce or consume information of the system, in any
solution
Operations = Verbs
! Computation ! Manipulation of data
! e.g., add, delete, modify attributes
Collaborations
! Query
! about the state of an object
! Monitor an object
! for the occurrence of a controlling event
10
Clase sunt acelea care PRIMESC MESAJE (sunt apelate) nu cele care TRANSMIT MESAJE (apeleaza)!
Dr. Radu Marinescu 11 Dr. Radu Marinescu 12
Class Diagrams
Class Diagrams
TariffSchedule Enumeration getZones() Price getPrice(Zone) Trip zone:Zone price:Price
Classes
Name
TariffSchedule zone2price getZones() getPrice()
Attributes Operations
Signature
! Class diagrams represent the structure of the system. ! Class diagrams are used
! during requirements analysis to model problem domain concepts ! during system design to model subsystems and interfaces ! during object design to model classes.
Instances
tariff_1974:TarifSchedule zone2price = { {1, .20}, {2, .40}, {3, .60}}
! An instance represents a phenomenon. ! The name of an instance is underlined and can contain the class of
the instance.
Associations
TarifSchedule Enumeration getZones() Price getPrice(Zone) Trip
price zone
1-to-1 association
Polygon
! Associations denote relationships between classes. ! The multiplicity of an association end denotes how many
objects the source object can legitimately reference.
Dr. Radu Marinescu 21
draw()
1-to-many association
Dr. Radu Marinescu 22
Aggregation
! An aggregation is a special case of association denoting a
consists of (HAS-A) hierarchy. ! The aggregate is the parent class, the components are the children class.
Car
Composition
! A solid diamond denote composition, a strong form of
aggregation where components cannot exist without the aggregate.
TicketMachine 3
ZoneButton
1 Engine
2..4 Door
23
24
Generalization
Button
CancelButton
ZoneButton
Sequence Diagrams
! Generalization relationships denote inheritance between classes. ! The children classes inherit the attributes and operations of the
parent class. ! Generalization simplifies the model by eliminating redundancy.
Dr. Radu Marinescu 25 Dr. Radu Marinescu
Representing Objects
! squares with object type, optionally preceded by object
name and colon
! write object's name if it clarifies the diagram ! object's "life line" represented by dashed vert. line
27
28
! dashed arrow back indicates return ! different arrowheads for normal / concurrent (asynchronous) methods
Nesting
29
30
Example 1:
! Building an executable from sources
! load source files and compile them ! load resulting object files and link them ! write executable file
Linker
Load Files
FileSystem
31
32
FileSystem
:BinaryViewer
:TextViewer
Flow of messages
ZoneButton TarifSchedule Display
Passenger
ChangeProcessor
CoinIdentifier
Display
CoinDrop
*insertChange(coin)
Iteration
Dataow
displayPrice(price)
to be continued... Condition
[owedAmount<0] returnChange(-owedAmount)
! ! ! !
The source of an arrow indicates the activation which sent the message An activation is as long as all nested activations Horizontal dashed arrows indicate data flow Vertical dashed lines indicate lifelines
Dr. Radu Marinescu 35
! !
Iteration is denoted by a * preceding the message name Condition is denoted by boolean expression in [ ] before the message name
Dr. Radu Marinescu 36