Beruflich Dokumente
Kultur Dokumente
UNIT 3
CSE 320
Software Engineering
1
Introduction
• Object-oriented design (OOD) techniques are now extremely
popular:
–Inception in early 1980’s and nearing maturity.
Behavioral view
Implementation view
Environmental view
Diagrams
Behavioural View and views
Structural View -Sequence Diagram
-Class Diagram
-Object Diagram
-Collaboration Diagram
-State-chart Diagram in UML
-- Activity Diagram
User’s View
9/6/2018
Use Case Model Behavioural View
Structural View -Sequence Diagram
Play Move
Tic-tac-toe game
Player
Play Move
actor and use case by a line <<external
system>>
Player Tic-tac-toe game
update
grades
faculty
Yet Another
Order System
Use Case
Check Example
Status
Salesperson
Place
Order
Fill
Shipping
Orders
Customer Clerk
Establish
credit
Supervisor
Factoring Use Cases
• Two main reasons for factoring:
–Complex use cases need to be factored into simpler use cases
–Helps represent common behavior across different use cases
• Three ways of factoring:
–Generalization
–Include
–Extend
Generalization
• The child use case inherits the
parent
behavior of the parent use case.
–The child may add to or override some
child
of the behavior of its parent.
Registration
Generalization
Example 1
Under-graduate Graduate
registration registration
Factoring Use Cases Using Generalization
<<include>>
<<include>>
<<include>>
<<include>>
<<include>>
<<include>>
Example of Factoring
Use Cases Using
Check Reservation Include
Example Factoring A Use Case
Using Extend
<<extend>>
Perform Sale Product is a gift
Gift wrap
After checkout Product
Order
Supply Product
Customer Data Arrange
Payment
<<include>>
<<include>>
<<include>>
Place Order
Cash Credit
Payment Payment
Sales Person
<<extend>>
Salesperson asks for catalog
Rent/Return
Videos
«include»
Staff
Search for Customer
Videos
Maintain
Customers
«include»
Maintain Example 1:
Videos
Solution
Generate
Manager Reports
Name
Actors Trigger Use Case
Preconditions Post Description
conditions
Mainline Scenario
Alistair Cockburn
“Writing
Effective Use
Alternatives flows Cases”
Identification of Use Cases
1. Actor-based:
- Identify the actors related to a system or organization.
- For each actor, identify the processes they initiate or participate
in.
2. Event-based
- Identify the external events that the system must respond to.
- Relate the events to actors and use cases.
Course Management Software
Register Example 2:
Course
offering
See
Model Solution
Course
Professor Show List
registration
<<Extend>>
Register <<External>>
Billing System
course
Student
Drop
Course
Calendar
• Use case name should begin with a verb.
• While use cases do not explicitly imply timing:
– Order use cases from top to bottom to imply timing -- it improves readability.
• Use cases should start off simple and at as much high view as
possible.
Effective Use Case
– Can be refined and detailed further. Modelling
• Use case diagrams represent functionality:
– Should focus on the "what" and not the "how".
Too many use cases
at any level should
be avoided!
Use Case Packaging
Accounts
Print
Query balance
Balance sheet
Receive Make
grant payments
Class Diagram
• Classes:
– Entities with common features, i.e. attributes and operations.
– Represented as solid outline rectangle with compartments.
– Compartments for name, attributes, and operations.
– Attribute and operation compartments are optional depending on
the purpose of a diagram.
UML Class Representation
• A class represents a set of objects having similar attributes,
operations, relationships and behavior.
Class Name
Window
A class can
size: Size implicitly
Attributes visibility: boolean have a few
association
attributes
display() hide()
Operations
Different representations of the LibraryMember class
–Represents generalization-specialization
Dog Cat
Inheritance
• Lets a subclass LibraryMember Base Class
inherit attributes
and methods from
Derived
a base class. Faculty Students Staff
Classes
Inheritance
Derived
Faculty Students Staff Faculty Students Staff
Classes
Multiple
Inheritance
height 4.0
Object
Reference
Mammal Quadruped
More
Generalization
Feline Lizard
Examples…
issuable reference
Issuable Reference
Issuable Reference
Single Single
BookSet BookSet
Volume Book Volume Book
Library Member
1 borrowed by *..5 Book
* eats * Human
Lion
opens 0..5
Key * Door
Quiz: Draw Class Diagram
• A Student can take up to five Courses.
Correct or
Wrong Student credits hasEnrolmentOf
Course
10..300 Enrols in 1..5
opens 0..5
* Door
Key
Example of
Class diagram
LibraryMember LibraryMember LibraryMember
Member Name Member Name
Membership Number Membership Number
Address Address
Phone Number Phone Number
E-Mail Address E-Mail Address
Membership Admission Date Membership Admission Date
Membership Expiry Date Membership Expiry Date
Books Issued Books Issued
issueBook( );
findPendingBooks( );
findOverdueBooks( );
returnBook( );
findMembershipDetails( );
1 borrowed by *
Library Member Book
72
Aggregation Relationship
Represent a whole-part relationship
Represented by diamond symbol at the composite
end
Cannot be reflexive(i.e. recursive)
Not symmetric
It can be transitive
73
Aggregation Relationship
1 * 1
Document Paragraph * Line
Representation of aggregation
74
Composition Relationship
Life of item is same as the order
1 *
Order Item
Representation of composition
75
Class Dependency
76
Object diagram
Mritunjay Mritunjay
B10028 B10028
C-108, Laksmikant Hall C-108, Laksmikant Hall
1119 1119
Mrituj@cse Mrituj@cse
25-02-04 25-02-04
25-03-06 25-03-06
NIL NIL
IssueBook( );
findPendingBooks( );
findOverdueBooks( );
returnBook( );
findMembershipDetails( );
78
Interaction diagram
Two kinds: Sequence & Collaboration
79
Sequence diagram
Shows interaction among objects as two-dimensional
chart
Objects are shown as boxes at top
If object created during execution then shown at
appropriate place
Objects existence are shown as dashed lines
(lifeline)
Objects activeness, shown as rectangle on
lifeline
80
Sequence diagram
Messages are shown as arrows
Message labelled with message name
Message can be labelled with control
information
Two types of control information: condition ([])
& an iteration (*)
81
Example of
Sequence diagram
:Library
:Library
:Library Book :Library
Book :Book
Boundary Renewal Member
Register
Controller
confirm
confirm
updateMemberBorrowing
82
Sequence Diagram for the renew book use case
Collaboration diagram
Shows both structural and behavioural aspects
Objects are collaborator, shown as boxes
Messages between objects shown as a solid line
Message is shown as a labelled arrow placed near
the link
Messages are prefixed with sequence numbers to
show relative sequencing
83
Example of
Collaboration diagram
6: * find
:Library
Book :Book
[reserved] Register
9: update
8: apology 5: book 10: confirm
Selected
1: renewBook :Library [reserved]
:Library Book 7: apology
Boundary 3: display Renewal
Borrowing Controller
4: selectBooks
2: findMemberBorrowing
12: confirm
:Library
Member
updateMemberBorrowing
85
Activity diagram
Can represent parallel activity and synchronization
aspects
86
Activity diagram
Normally employed in business process modelling
87
Example of
Activity diagram
Academic Section Accounts Section Hostel Office Hospital Department
check
student
records
receive
fees
allot create
hostel hospital
record
register
receive
in
fees
course
conduct
allot medical
room examination
issue
identity card
Activity diagram for student admission procedure at IIT 88
State Chart diagram
Based on the work of David Harel [1990]
89
State Chart diagram
Elements of state chart diagram
Initial State: Filled circle
Final State: Filled circle inside larger circle
State: Rectangle with rounded corners
Transitions: Arrow between states, also boolean
logic condition (guard)
90
Example of
State Chart diagram
order received
Unprocessed
Order
[reject] checked [accept] checked
Rejected Accepted
Order Order
[some items available]
[some items not processed / deliver
available] processed
[all items
Pending available] Fulfilled
Order newsupply Order