12 UML
Phases of Software Engineering¶
flowchart LR
a[Requirement Gathering] -->
b[Requirement Analysis] -->
d["Design<br />(UML Diagrams)"] -->
Coding -->
Testing -->
Deployment -->
Support
UML¶
Unified Modeling Language
Use Case Diagram¶
Actors¶
classes
could be
- users of the system
- external system
- physical environment
Properties
- unique name
- description (optional)
Use Cases¶
basically like functions
properties
- unique name
- participating actors
- entry conditions
- exit conditions
- event flow
- exceptional cases
<<extends>>
¶
for exceptions/showing use cases that are rarely used
The direction of a <<extends>>
relationship is to the extended use case
<<includes>>
¶
for use cases that require/depend on another use case
The direction of a <<includes>>
relationship is to the using use case (unlike <<extends>>
relationships).
Class Diagram¶
Access Specifiers¶
- (nothing) default
-
private+
public#
protected
Connections¶
-
association
- can be 1-way or 2-way
- can be one-one or many-many \(1-1, \quad 5\ldots* - *, \quad *- 3\ldots *, \quad * - *\)
- arrow from a towards b, means that a depends on b
-
aggregation
- composition (strong aggregation)
- inheritance
- class inheritance
- interface inheritance
Example¶
classDiagram
Interface <|.. Base: implements
Base <|-- Teacher
Base <|-- Student
Base <.. Tester
ClassRoom *-- Teacher
ClassRoom o-- Student
class Interface {
<<interface>>
+func() void
}
class Base {
<<abstract>>
#var : int
+func() void
}
class Tester {
+main() void
}
Sequence Diagram¶
Shows the interactions bw the classes/objects
calls are solid, returns are dashed
sequenceDiagram
autonumber
activate d
d ->>+ p: Discharge Advice
activate r
p ->>- r: Discharge Request
r ->> + pd: Check Details
pd -->> - r: Detailed Summary
r ->> r: Prepare Bill
r -->>+ p: Send Bill
p ->>- r: Request Discount
r ->> d: Check Possibility of discount
d -->> r: Approve Discount
deactivate d
r ->> r: Update bill
r ->>+ p: Send bill
p -->>- r: Pay bill
r ->> +pd: Update Bill
deactivate pd
activate p
r ->> p: Discharge note
deactivate r
p ->> + Ward: Show note
Ward -->> - p: Discharge
deactivate p
%% participant
participant d as Doctor
participant p as Patient
participant r as Reception
participant pd as Patient Database
State Diagrams¶
stateDiagram-v2
[*] --> dr
dr --> cp: Patient Register
cp --> er: Resign
er --> [*]
state "Doctor Registration" as dr
state "Check Patient" as cp
state "End Service" as er