Professional Documents
Culture Documents
1
UML
• The UML uses mostly graphical notations to express the OO analysis and
− Behavioral view
− Implementation view
− Environmental view
9 Diagrams and
5 views in UML
User’s View
-Use Case Diagram
•issue-book
•query-book
•return-book Example
Use Cases
•create-member
•add-book, etc.
An Example Use Case 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 Use
Order System
Case Example
Check
Status
Salesperson
Place
Order
Fill
Shipping
Orders
Customer Clerk
Establish
credit
Supervisor
Factoring Use
• Two main reasons for factoring: Cases
–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
• 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".
Extension Point
• The base use case may include/extend other use cases:
– At certain points, called extension points.
<<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
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
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
Animal
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
1 borrowed by *
Library Member Book
67
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
68
Aggregation Relationship
1 * 1
Document Paragraph * Line
Representation of aggregation
69
Composition Relationship
1 *
Order Item
Representation of composition
70
Class Dependency
71
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( );
73
Interaction diagram
74
Sequence diagram
75
Sequence diagram
76
Example of
Sequence diagram
:Library
:Library
:Library Book :Library
Book :Book
Boundary Renewal Member
Register
Controller
confirm
confirm
updateMemberBorrowing
78
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
80
Activity diagram
81
Activity diagram
82
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 83
State Chart diagram
Based on the work of David Harel [1990]
84
State Chart diagram
85
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