UML Diagrams
Unified Modeling Language (UML) provides standardized ways to visualize software system design. UML diagrams help teams communicate design decisions and document system architecture.
Use Case Diagram
USE CASE DIAGRAM - Online Store
===============================
+-------------------+
| Customer |
+--------+----------+
|
| (actor)
|
+--------v----------+
| +----------------+| +------------------+
| | Browse Products||----->| |
| +----------------+| | |
| +----------------+| | Online Store |
| | Add to Cart ||----->| System |
| +----------------+| | |
| +----------------+| | |
| | Checkout ||----->| |
| +----------------+| +------------------+
| +----------------+|
| | View Order ||
| +----------------+|
Actors: People or systems that interact with the system
Use Cases: What the system can do
System Boundary: What's inside the system
Class Diagram
CLASS DIAGRAM - E-Commerce
==========================
+------------------+ +------------------+
| Product | | Order |
+------------------+ +------------------+
| - id: int | | - id: int |
| - name: string | | - date: Date |
| - price: float | | - total: float |
+------------------+ +------------------+
| + getName() | | + calculateTotal()|
| + getPrice() | | + addItem() |
+------------------+ +------------------+
| |
| |
v v
+------------------+ +------------------+
| CartItem | | OrderItem |
+------------------+ +------------------+
| - quantity: int | | - quantity: int |
| - product: Product| | - product: Product|
+------------------+ +------------------+
+--------+ has many +-----------+
| Order |----------->| OrderItem |
+--------+ +-----------+
Sequence Diagram
SEQUENCE DIAGRAM - Login Process
=================================
User LoginView AuthController Database
| | | |
| enter creds | | |
|-------------->| | |
| | authenticate | |
| |-------------->| |
| | | findUser |
| | |--------------->|
| | | user data |
| | |<---------------|
| | | verifyPass |
| | success | |
| |<--------------| |
| redirect | | |
|<--------------| | |
Time flows downward.
Messages are sent between objects.
Other UML Diagram Types
- Activity Diagram: Workflow and business processes (like a flowchart)
- State Diagram: Object states and transitions
- Component Diagram: Software components and dependencies
- Deployment Diagram: Physical hardware and software deployment
Key Takeaways
- Use Case diagrams show system functionality from the user's perspective
- Class diagrams show static structure and relationships
- Sequence diagrams show object interactions over time
- UML provides a common language for design communication