Professional Documents
Culture Documents
Object Modelling Using Uml: Subrat//Se
Object Modelling Using Uml: Subrat//Se
SUBRAT//SE 1
Analysis & Design
Analysis emphasizes an investigation of the problem and
requirements rather than a solution.
Design emphasizes a conceptual solution that fulfils the
requirements, rather than its implementation.
During Object-Oriented Analysis, there is an emphasis on
finding and describing the objects or concepts in the problem
domain.
During Object-Oriented Design there is an emphasis on
defining software objects and how they collaborate to fulfill the
requirements.
In case of Library Information System some of the concepts
include Book, Library & Patron.
In the Library system, a Book software object may have a title
attribute and getChapter method.
SUBRAT//SE 2
Abstraction Dynamic Binding
Polymorphism Genericity
Key Concept
Objects
Inheritance
SUBRAT//SE 3
An Example
Consider a “Dice Game” in which a player rolls two dice. If the total
is 7,
they win; otherwise , they loose.
SUBRAT//SE 4
Define use cases
SUBRAT//SE 5
Define a Domain Model
1 2
1 plays
Dice-Game 1 includes
Here the noteworthy concepts are player, die & dice game, with their
associations &
attributes. Domain model is not a description of software objects ; it is a
visualization SUBRAT//SE 6
of concepts in the real world domain.
Define Interaction Diagrams
Object-Oriented Design (OOD) is concerned with defining software
objects
and their collaborations. A common notation to illustrate
these
collaborations is the interaction diagram. It shows the flow of
Formessages
a software implementation of the dice game the interaction
diagram is as
between software objects and thus the invocation of methods.
follows:-sending messages to instances of the Dice-Game & Die
classes. :Dice-Game Die1:Die Die2:Die
Play()
roll()
fv1:=get-Face-Value()
roll()
fv2:=get-Face-Value()
SUBRAT//SE 7
In the real world, a player rolls the dice , in the software design
the Dice
Game object “rolls” the dice (that is , sends messages to Die
objects)
Software objects designs & programs do take some inspirations from
real
world domains, but they are not direct models or simulations of the
real world.
SUBRAT//SE 8
Define Design Class Diagrams
die1:Die 1 2 faceValue:int
die2:Die
getFaceValue(): int
play()
roll()
A play message is sent to a DiceGame object , the DiceGame class
requires a
play method , while class die requires a roll and getFaceValue
method. It
SUBRAT//SE 9
shows software classes
Model
SUBRAT//SE 10
UML
SUBRAT//SE 11
State
State
Diagrams
Class
Diagrams
Use Case Diagrams
Use Case
Diagrams State
Use Case Use Case
Diagrams State
Diagrams
Use Case Diagrams Object
Diagrams
Diagrams
Sequence Diagrams
Diagrams
Diagrams
Scenario State
Scenario
Diagrams State
Diagrams
Collaboration
Diagrams UML Component
Diagrams
Diagrams Diagrams
Scenario Component
Scenario
Diagrams
Component
Diagrams
Deployment
Statechart
Diagrams Diagrams
Diagrams Diagrams
Activity
Diagrams
SUBRAT//SE 12
The UML diagrams can capture the following views of a system:-
Structural View
User’s View
Behavioral View
Implementation View
Environmental View
-Activity diagram
User’s view
-Use Case
Diagram
SUBRAT//SE 14
The behavioural view captures how objects interact with each
other to realize the system behaviour.
• A use-case model represents the use-case view of the system. A use-case view of a
system may consist of many use case diagrams.
• An use-case diagram shows (the system) the actors, the use-cases and the
relationship among them.
• Use cases represent the different ways in which a system can be used by the users.
SUBRAT//SE 16
The use cases partitions the system behaviour into transactions
such that each transactions performs some useful action from the
user’s point of view.
Use case means : What the user’s can do using the system?
Construc
A c t o r N a m
U
e
Construct
associatio
<<extend>>
SUBRAT//SE 20
Construc <<include>>
include
instances by a common goal.
SUBRAT//SE 21
Text Description
The text description should define the details of the interaction
between the user and the computer and other aspects of the
use case. It should include all the behaviour associated with the use
case in terms of the mainline sequence, different variations to the
normal behaviour , the system responses associated with the use
case, the exceptional conditions that may occur in the behaviour,
etc.
SUBRAT//SE 22
ACTOR
SUBRAT//SE 23
Finding Actors
SUBRAT//SE 24
Example
Play Move
SUBRAT//SE 25
Boundary Use Case
Actor
Library System
Borrow
Employee
Client
Order Title
Fine Remittance
Supervisor
register-
customer
customer
register-
sales
sales clerk
select
winners
Super Market
manager Prize Scheme
SUBRAT//SE 28
Text Description
Use Case-1: register customer: Using this case , the customer
can register himself by providing the necessary details.
Scenario 1: Mainline sequence:
Customer: select register customer option.
System: display prompt to enter name, address, and telephone
number.
Customer: enter the necessary values
System: display the generated id and the message that the
customer has been successfully registered.
Scenario 2: Variations
System : displays the message that the customer has already
registered.
System: displays the message that some input information has
not been entered. The system displays a prompt to enter the
missing value.
SUBRAT//SE 29
Use Case-2: register sales: Using this case , the clerk can
register the details of the purchase made by a customer.
Scenario 1: Mainline sequence:
Clerk: selects the register sales option.
System: displays prompt to enter purchase details & the id of the
customer.
Clerk: enters the required details.
System: displays a message of having successfully registered the
sale.
Use Case-3: select winners: Using this case , the manager can
generate the winner list.
Scenario 1: Mainline sequence:
Manager: selects the select winner option.
System: displays the gold coin and the surprise gift winner list.
SUBRAT//SE 30
Finding Use Cases
• For each actor ask these questions:
SUBRAT//SE 32
Includes
The includes relationship involves one use case including the
behaviour of another use case in its sequence of events and actions.
The includes relationship occurs when you have a chunk of behaviour
that is similar across a number of use cases.
<<includes>>
SUBRAT//SE 33
Issue- Renew-
book book
<<includes>>
<<includes>>
<<includes>>
<<includes>>
Updated
Check Get user
selected
reservation selection
books
SUBRAT//SE 34
Extends
It allows to show optional system behaviour. An optional system
behaviour is executed only under certain conditions. It is normally
used to capture alternate paths or scenarios.
<<extends>>
Base use case Common use case
SUBRAT//SE 35
Use Case Packaging
Portfolios
Create
Aggregate
New
Portfolios
Portfolio
Generate
View
Portfolio
Portfolio
Report
SUBRAT//SE 36
Use Case Packaging
Accounts
Query Print
balance balance
sheet
Receive
Make
grant
payments
SUBRAT//SE 37
Example
• Captures system functionality as seen by users
SUBRAT//SE 38
CLASS DIAGRAMS
SUBRAT//SE 39
Classes
SUBRAT//SE 40
Class Notation
Name
Attributes
Operations
SUBRAT//SE 41
Alternative Class Notations
Name Name
Attributes Attributes
Name
Operations Operations
Responsibilities
italics abstract
SUBRAT//SE 42
Example
Library Member
Member name
Address
Phone number
E-Mail address
issueBook();
retunBook();
findPendingBooks();
SUBRAT//SE 43
Attributes
An attribute is a named property of a class that describes a range
of values that instances of the property may hold.
These are listed with their names and may optionally contain
specification of their type , an initial value and constraints.
Attribute names are written left justified using plane type letters,
and the name should begin with a lowercase letters.
Attribute names may be followed by a square brackets containing
a multiplicity expression. An attribute without square bracket
must hold one value.
SUBRAT//SE 44
Operation
An operation is something that is supported by a class and
invoked by objects of other classes.
These are typically left-justified , in plane type and always begin
with a lowercase letter.
Abstract operations are written in italics.
SUBRAT//SE 45
Association
SUBRAT//SE 46
Association between two classes is represented by drawing a
straight line between the concerned classes.
1 Borrowed by
*
Library Member Book
SUBRAT//SE 47
Association Multiplicity
• On each side of the association relation, the multiplicity is
noted as an individual number or as a value range.
• The multiplicity indicates how many instances of one class are
associated with the other.
• Value ranges of multiplicity are noted by specifying the
minimum and maximum value separated by dots like 1.5
• An asterisk is a wild card and means many.
• Possible values same as for classes: explicit value, range, or *
for “many”
• Example: a Person is employed by one Company; a Company
employs one or more Persons
*
Person Company
1
SUBRAT//SE 48
Aggregation
Aggregation is a “whole/part” or “has a” relationship within which
one class represents a larger thing that consists of smaller things.
Company
Department
SUBRAT//SE 49
1 * 1 *
Document Paragraph Line
SUBRAT//SE 50
Composition
Window
Frame
SUBRAT//SE 51
Inheritance
Library Book
issuable reference
issuable
discriminators
reference
SUBRAT//SE 52
The set of subclasses of a class having the same discriminator is
called a partition.
SUBRAT//SE 53
Dependency
SUBRAT//SE 54
OBJECT DIAGRAMS
Library Member
SUBRAT//SE 55
INTERACTION DIAGRAMS
SUBRAT//SE 56
The two diagrams are equivalent in the sense that any one
diagram can be derived automatically from the other.
SUBRAT//SE 57
SEQUENCE DIAGRAMS
The objects appearing at the top signify that the objects already
existed when the use case execution was initiated.
SUBRAT//SE 58
A lifeline is a vertical dashed line that represents the lifetime of
an object which indicates the existence of the object at any
particular point of time.
SUBRAT//SE 59
Sequence diagrams can be used in conjunction with use-cases at
the requirements phase, or at the design phase they can be used
to show the system’s behavior that corresponds to a use-case.
SUBRAT//SE 60
Components of Sequence Diagrams
Lifeline
Lifeline
– dashed line, represents
time flow
SUBRAT//SE 61
• Messages :ProductOrder :StockItem
– communication
between objects Message
check()
– method calls at the
implementation level needsToReorder()
SUBRAT//SE 62
• Two kinds of control :Order :ProductOrder :StockItem
information:
*prepare()
check()
– message conditions Iteration
• message is sent [check=“true”]
only if the condition remove()
is true message
condition
– iteration marker: *
• message sent to
multiple receiver
objects
SUBRAT//SE 63
• Focus of control (or :Order :ProductOrder :StockItem
activation) can be shown
in sequence diagrams as a *prepare()
thin rectangle put on top of check()
Iteration
the lifeline of an object
• Shows the period of time [check=“true”]
during which the given remove()
message
object is in control of the condition
flow
• It is optional to use focus of
control rectangles in a
sequence diagram
focus of control
– use it when it adds to or activation
clarity
lifeline
SUBRAT//SE 64
Example
prepare()
*prepare()
check()
[check=“true”]
remove()
needsToReorder()
[needsToReorder=“true”]
<<create>>
:ReorderItem
[check=“true”]
<<create>>
:DeliveryItem
SUBRAT//SE 65
SUBRAT//SE 66
Example (LAS) for renew book use case
:Library Book
:Library Book :Library
Renewal :Book
:Library Boundary Register Member
controller
renewBook
FindMemberBorrowing
displayBorrowing
bookselected
*find
selectBook [reserved]
apology
update
[reserved]
apology
conform
conform
updateMemberBorrowing
SUBRAT//SE 67
COLLABORATION DIAGRAMS
SUBRAT//SE 68
A use case of the collaboration diagrams in our development
process would be to help us determine which classes are
associated with which other classes.
SUBRAT//SE 69
6:*find
5: conform
[reserved]
1: renewBook 7: apology
:Library Book
:Library
Renewal
Boundary
controller
3: displayBorrowing
2: FindMemberBorrowing
4:selectBook
11: updateMemberBorrowing
SUBRAT//SE 71
Activity diagrams are normally employed in business process
modeling. This is carried out during the initial stage of
requirements analysis & specification.
These diagrams can be used to develop interaction diagrams
which help to allocate activities (responsibilities) to classes.
SUBRAT//SE 72
Academic section Accounts section Hostel office Hospital Department
Check
student
records
receive
fees
Allot
hostel Create
hospital
record
Receives
Register in
fees
courses
Conduct
medical
Allot
examination
room
Issue
identity
card Student admission procedure at IIT
SUBRAT//SE 73
The diagram shows the part played by different components of
the institute in the admission procedure. After the fees are
received at the account section , parallel activities start at the
hostel office , hospital & the department.
After all these activities complete the identity card can be issued
by the academic section.
SUBRAT//SE 74