Lab 1b. Draw UML Diagram
Lab 1b. Draw UML Diagram
Usecase Class
diagram diagram
Analysis
I would a software
that can ABC, XYZ
Sequence
…
diagram
3
Usecase diagram
First step: define actor - who can use software
What type of actors are needed in requirement?
4
Usecase diagram
User
Use UML User
Employee
Manager
Employee
Manager
5
Usecase diagram
Second step: define usecase - the function that the actors will use
What functions are needed in requirement?
6
Association Usecase
Usecase diagram
Register
User
User:
Sign in, Sign out Sign in
8
Generalization
Register
Register
Sign in
User User
Sign in
Sign out
Signin
User
Signout
Create bill
<<include>> Create
<<include>> items
CRUD Update
<<include>>
items items
Manager
<<include>>
Delete
items 10
Usecase diagram
Fourth step: draw by PowerPoint, Visio or draw.io
11
Exercise
A company specializing in the business of electronic devices wants to
build an e-commerce system.
The new system must ensure that customers visiting the website can
easily select products, view promotions and make purchases. Payment
can be made online or in-store. Customers can receive goods at the
store or use delivery service.
In addition, the system also needs a module to ensure the company
manages business activities such as the quantity of goods in stock,
order management, delivery status, payment, etc.
12
Cart / Search
Purchase
Buy
View
promotion
User Login /
Logout
Account <<include>>
Register
Item
management
Order
status
Seller
<<include>>
Order
Support
management
customer
13
Object
:User :LoginTab :Backend
Sequence diagram
1. Enter
username /
pass
Object 2.
Login()
3. Validate()
Stimulus (message) 4. Message()
[else] 5.2.
Message() 6.2. Do
Nothing()
Time 14
Sequence diagram
First step: define the function by getting information from Usecase
diagram
15
Sequence diagram
Register
:username
:password
success Go to
fail homepage
17
Sequence diagram
Third step: determine the class in the system that participates in the
business.
User
:username Backend
Frontend
:password
success Go to
fail homepage
18
Sequence diagram
Fourth step: draw!
19
Exercise
A library is doing the digitization of book management.
20
:User :ViewTab :ReadBook :dbBook
1. Enter book
title
2. Request()
3. Request()
4. result
5. result
21
Class diagram Class name
ACCOUNT DETAIL_BILL
Composition Attribute
CUSTOMER Username
Hash …
Name Type Method
…
Update()
Association
EMPLOYEE ITEM
Name: String BILL Name
Manager: Employee Price
Date
UpdateName(String newname): Generalization Type Type
Boolean
…
IMPORT_BILL …
…
Detailed class
…
22
Class diagram
The class diagram is the hardest diagram. Defining classes base on:
- Requirement
- Usecase diagram
23
Database diagram Table
Relatiopship
ITEM
EMPLOYEE BILL ID (PK)
ID (PK) ID (PK) Name
ID_Account (FK) ID_Customer (FK) Price
Name ID_Employee (FK) Type
ID_Manager Date
Type
IMPORT_BILL
…
24
Database diagram
Map classes to tables:
- Add key
- Attribute => Field
- Relationship => Foreign Key
25
Exercise
Library management database
- Book
- Reader
-…
26