UML = blueprint for software. Two types: Structural (class, object diagrams), Behavioral (sequence, activity diagrams)

🏛️ Class Diagram


Identify domain classes (User, Expense), add attributes/methods, draw relationships (1..*

Naming: <<Interface>> |  Abstract class   |   Object

Naming: <<Interface>> | Abstract class | Object

🔗 Types of Relationships

Relationship Lines Meaning
Association —— connection between two classes (1: M), (M: N) E.g., User has Profile. Types:

——1 (one) ——0…1 (atmost 1) ——* (any) ——1…* (atleast 1) | | Inheritance | —▶ | or Generalisation | | Realization | ---▶ | A class implements an interface. | | Dependency | ---> | uses-a relation. (method param) | | Aggregation | Team ◇--- Player | has-a relationship. | | Composition | House ◆--- Room | lives inside relationship |

🧱 Entity Relationship Diagrams


Helps design structured databases by visually mapping out relationships between data.

Core Components

Concept Explanation Example
Entity Object that stores data Customer, Product, Order
Entity Set Collection of similar entities All customers in an app
Attributes Properties that describe each entity email, price, orderDate
Primary Key Uniquely identifies an entity customer_id, order_id
Weak Entity Depends on another entity, lacks a PK OrderItem depends on Order

Relationships can be:

Strategy Real-World Use Case
Specialization Payment can specialize into CreditCard, PayPal, UPI
Generalization Admin and Customer generalize into a single User type