Ooad Unit 2 Notes
Ooad Unit 2 Notes
Class Diagram–– Elaboration – Domain Model – Finding conceptual classes and description classes –
Aggregation and Composition – Relationship between sequence diagrams and use cases –
Class
Associations (cont.)
Role
name
Association
name
instructor
StaffMember Student
1..* instructs *
Role
Navigable
Multiplicity (uni-directional)
association * pre -
requisites
Courses
0..3
Reflexive
association
Multiplicity
– the number of objects that participate in the association.
– Indicates whether or not an association is mandatory.
Multiplicity Indicators
Exactly one 1
•Aggregation tests:
– Is the phrase “part of” used to describe the relationship?
• A door is “part of” a car
– Are some operations on the whole automatically applied to its parts?
• Move the car, move the door.
– Are some attribute values propagated from the whole to all or some of its parts?
• The car is blue, therefore the door is blue.
– Is there an intrinsic asymmetry to the relationship where one class is subordinate to the
other?
• A door is part of a car. A car is not part of a door.
Composition
• A strong form of aggregation
– The whole is the sole owner of its part.
• The part object may belong to only one whole
– Multiplicity on the whole side must be zero or one.
– The life time of the part is dependent upon the whole.
• The composite must manage the creation and destruction of its parts.
Generalization
• Indicates that objects of the specialized class (subclass) are substitutable for objects of the
generalized class (super-class).
– “is kind of” relationship.
Dependency
• Dependency is a weaker form of relationship which indicates that one class depends on
another because it uses it at some point in time.
• One class depends on another if the independent class is a parameter variable or local variable
of a method of the dependent class.
• This is different from an association, where an attribute of the dependent class is an instance
of the independent class.
Constraint Rules and Notes
• Constraints and notes annotate among other things associations, attributes, operations and
classes.
• Constraints are semantic restrictions noted as Boolean expressions.
•
UML offers many pre-defined constraints
• Department has Instructors and instructors can work for one or more departments.
◼ Student can enroll in up to 5 Subjects.
ELABORATION
• Elaboration is the initial series of iterations during which:
o the majority of requirements are discovered and stabilized
o the major risks are mitigated or retired
o the core architectural elements are implemented and proven
• Refined vision, iterative implementation of the core architecture, resolution of high risks,
identification of most requirements and scope, more realistic estimates.
• It is described as a phase in which throw-away prototypes are created, thus reducing the need
for attention to care in the programming or design. This is not accurate; production-quality
(albeit partial) designs and code are created during elaboration.
What Artifacts May Start in Elaboration?
Artifact Comment
Domain Model This is a visualization of the domain concepts; it is similar to a
static information model of the domain entities.
Design Model This is the set of diagrams that describes the logical design. This
includes software class diagrams, object interaction diagrams,
package diagrams, and so forth
Software A learning aid that summarizes the key architectural issues and
Architecture their resolution in the design. It is a summary of the
Document outstanding design ideas and their motivation in the system.
Data Model This includes the database schemas, and the mapping strategies
between object and non-object representations.
Use-Case A description of the user interface, paths of navigation, usability
Storyboards, models, and so forth.
UI Prototypes
DOMAIN MODEL
A domain model is a visual representation of conceptual classes or real-world objects in a
domain of interest. They have also been called conceptual models, domain object models, and
analysis object models.
The UP defines a Domain Model as one of the artifacts that may be created in the Business
Modeling discipline.
Using UML notation, a domain model is illustrated with a set of class diagrams in which no
operations are defined.
It may show:
• domain objects or conceptual classes
• associations between conceptual classes
• attributes of conceptual classes
The domain model may be considered a visual dictionary of the noteworthy abstractions,
domain vocabulary, and information content of the domain.
On Naming and Modeling Things: The Mapmaker
The mapmaker strategy/Domain Vocabulary strategy applies to both maps and domain
models.
• Use the existing names in the territory.
• Exclude irrelevant features.
Example: POS
III) Association
Associations are relationships between classes in a UML Class Diagram. They are
represented by a solid line between classes. Associations are typically named using a verb or verb
phrase which reflects the real world problem domain.
How to Find Associations?
Two main ways:
– By reading the current, relevant, requirements and asking ourselves what information is
needed to fulfil these requirements
– Using a list of association categories.
Association Category Examples
A is a transaction related to another transaction B Payment-Sale
Cancellation-Reservation
A is a line item of a transaction B SalesLineItem-Sale
A is a product or service for a transaction (or line item) B Item-SalesLineItem
A is a role related to a transaction B Customer-Payment
A is a physical or logical part of B Drawer-Register
Square-Board
Seat-Airplane
A is physically or logically contained in/on B Register-Store
Item-Shelf
A is a description for B ProductDescription-Item
A is known/logged/recorded/reported/captured in B Sale-Register
A is a member of B Cashier-Store
A is an organizational subunit of B Department-Store
A uses or manages or owns B Cashier-Register
Player-Piece
A is next to B SalesLineItem-SalesLineItem
The following sample of associations is justified in terms of a need-to-know. It may be
justifiable to delete the associations in question.
Sale Paid-by To know if the sale has been paid,relate the amount tendered to thesale
Payment total, and print a receipt.
IV) Attributes
An attribute is a logical data value of an object. Include attributes that the requirements (for
example, use cases) suggest or imply a need to remember information.
Example:
Sale - dateTime
Store – name and address
Cashier – ID
Attribute Notation
71
When Are Description Classes Useful?
Add a description class (for example, ProductDescription) when:
• There needs to be a description about an item or service, independent of the current existence
of any examples of those items or services.
• Deleting instances of things they describe (for example, Item) results in a loss of information
that needs to be maintained, but was incorrectly associated with the deleted thing.
• It reduces redundant or duplicated information.
Example: A Person may work for a single Company. We need to keep information about the period
of time that each employee works for each Company. We can do this by adding a dateRange attribute
to the association.
72
What is needed is a distinction between the historical price when the sale was made, and the current
price.
Depending on the information requirements, there are at least two ways to model this.
• Simply copy the product price into the SalesLineltem, and maintain the current price in
the ProductDescription.
•
Associate a collection of ProductPrices with a ProductDescriptions, each with an associated applicable
time interval. Thus the aggregation can record all past prices and also record future planned price.
Aggregation
A special type of association. The relationship is displayed as a solid line with a hollow
diamond at the association end, which is connected to the class that represents the aggregate .
• It represents a "part of" relationship.
• Objects of both classes have separate lifetimes.
Example: Passengers are part of Car
Composition
A special type of aggregation where parts are destroyed when the whole is destroyed. The
relationship is displayed as a solid line with a filled diamond at the association end, which is
connected to the class that represents the whole or composite.
Example: Objects of Engine live and die with Car. Engine cannot stand by itself.
How to Identify Composition
Consider showing Composition when:
• The lifetime of the part is bound within the lifetime of the composite —there is a create-delete
dependency of the part on the whole.
Package Dependencies
If a model element is in some way dependent on another, the dependency may be shown with
a dependency relationship, depicted with an arrowed line.
Example: Sales package has a dependency on the Core Elements package
Products Package
A System Sequence Diagram is an artifact that illustrates input and output events related to
the system under discussion. They are input to operation contracts and object design.
System Sequence Diagrams are typically associated with use-case realization in the logical
view of system development.
Sequence Diagrams (Not System Sequence Diagrams) display object interactions arranged
in time sequence.
Sequence Diagram
Sequence Diagrams depict the objects and classes involved in the scenario and the
sequence of messages exchanged between the objects needed to carry out the functionality of the
system.
Sequence diagrams can be used to drive out testable user interface requirements.
A System sequence diagram is a picture that shows, for one particular scenario of a usecase,
the events that external actors generate, their order, and inter-system events. All systems are treated
as a Black-box; the emphasis of the diagram is events that cross the system boundary from actors to
systems.
Basically a system reacts to three things: 1) External events from actors (humans or computers)
2) timer events 3) Faults or exceptions(which are often from external Sources) Therefore it is
necessary to know what are the external input events i.e the system events. They are an important
part of analysing system behaviour.
System behaves as “Black Box”. Before proceeding to a logical design of how a software
application will work, it is useful to investigate and define its behavior as a "black box." System
behavior is a description of what a system does, without explaining how it does it. One part of that
description is a system sequence diagram. Other parts include the use cases, and system contracts.
In SSD, interior objects are not shown, as they would be on a Sequence Diagram.
System
In System Sequence Diagrams, Use cases describe:
Object:
Objects are instances of classes. Object is represented as a rectangle which contains the name of
the object underlined.
Because the system is instantiated, it is shown as an object.
:Object1
Actor: An Actor is modeled using the ubiquitous symbol, the stick figure.
actor 1
Lifeline: The LifeLine identifies the existence of the object over time. The notation for a Lifeline is a
vertical dotted line extending from an object.
Message: Messages, modeled as horizontal arrows between Activations, indicate the communications
between objects.
messageName(argument)
Examples of SSD
Following example shows the success scenario of the Process Sale use case.
Events generated by cashier (actor)-
makeNewSale, enterItem, endSale and makePayment.
SSD for Process Sale Scenario
Relationship between System Sequence Diagrams and Use Cases
System Sequence Diagram is generated from inspection of a use case.
Constructing a systems sequence diagram from a use case:
• Draw a line representing the system as a black box.
• Identify each actor that directly operates on the system. Draw a line for each such actor.
• From the use case, typical course of events text, identify the system (external) events that each
actor generates. They will correspond to an entry in the right hand side of the typical use case.
Illustrate them on the diagram.
• Optionally, include the use case text to the left of the diagram.
SSDs are derived from Use Cases
In the process Sale example, the customer does not directly interact with the POS system. Cashier
interacts with the system directly. Therefore cashier is the generator of the system events.
Defining the System Boundary
Naming System Event and System Operations
System events- They are external input events generated by an actor and they initiate a
responding operation by system. System events should be expressed at the abstract level of intention
rather than in terms of the physical input device.
"enteritem" is better than "scan" (that is, laser scan) because it captures the intent of the operation
while remaining abstract and noncommittal with respect to design choices about what interface is
used to capture the system event. It also improves clarity to start the name of a system event with a
verb (add..., enter..., end..., make...), since it emphasizes the command orientation of these events.
The terms shown in SSDs (operations, parameters, and return data) are
terse. These may need proper explanation so that during design work it is clear
what is coming in and going out. If this was not explicated in the use cases, the
Glossary could be used.
For eg: Changedue, receipt – It is a vague description and a complex report. So the
glossary can have a receipt entry, which shows sample receipts and detailed contents
and layout.