5.1 Object-Oriented Analysis & Modeling
OOA focuses on identifying domain objects, their responsibilities, and relationships from real-world problem statements.
Key OOAD Principles
- Encapsulation: Bundling attributes and methods into a single class unit while protecting data via private access modifiers.
- Abstraction: Exposing essential contract features while suppressing internal algorithms.
- Inheritance: Subclasses acquire properties and methods of superclasses (
is-a taxonomy).
- Polymorphism: Ability of a single interface to invoke dynamic method behaviors at runtime.
5.2 Class & Object Relationships
1. Association
A general semantic link between two independent classes (e.g., Student attends Course). Can be Unidirectional or Bidirectional with Multiplicity (1..1, 1..*, 0..*).
2. Aggregation
A weak "has-a" structural relationship where child objects can exist independently of parent object lifecycles.
- Visual Notation: Line with an Open (unfilled) Diamond at parent end.
- Example:
Department and Professor. Deleting a Department does NOT destroy Professor objects.
3. Composition
A strong "part-of" structural relationship where child object lifecycles are bound strictly to parent object lifecycles.
- Visual Notation: Line with a Filled (black) Diamond at parent end.
- Example:
Building and Room. Deleting a Building automatically destroys all its Rooms.
4. Generalization / Inheritance
An "is-a" taxonomy relationship where a specialized subclass inherits attributes and methods from a general superclass.
- Visual Notation: Line with an Open Triangular Arrowhead pointing towards superclass.
- Example:
Car is a Vehicle.
5.3 Introduction to Unified Modeling Language (UML)
UML is a standardized graphical modeling language developed by Grady Booch, James Rumbaugh, and Ivar Jacobson (Object Management Group - OMG).
Categorization of UML Diagrams
UML Diagrams
|
+-----------------+-----------------+
| |
Structural Diagrams Behavioral Diagrams
- Class Diagram - Use Case Diagram
- Object Diagram - Sequence Diagram
- Component Diagram - Activity Diagram
- Deployment Diagram - State Machine Diagram
- Package Diagram - Communication Diagram
5.4 Detailed Breakdown of Key UML Diagrams
1. Class Diagram (Structural)
Static structural diagram depicting system classes, attributes, operations (methods), access visibility (+ public, - private, # protected), and relationships.
2. Use Case Diagram (Behavioral)
Models user functional goals and system scope.
- Actor (Stick Figure): External entity interacting with system.
- Use Case (Oval): Named sequence of actions delivering measurable value to actor.
- Relationships:
<<include>>: Mandatory sub-use case executed every time base use case runs (e.g., Withdraw Cash <<includes>> Authenticate PIN).
<<extend>>: Optional/conditional sub-use case executed only when specific conditions occur (e.g., Withdraw Cash <<extends>> Print Receipt).
3. Sequence Diagram (Behavioral / Interaction)
Emphasizes Time Ordering of messages passed between object lifelines.
- Lifeline (Vertical Dashed Line): Represents existence of an object instance over time.
- Activation Box (Rectangle on lifeline): Indicates time period during which object is performing an operation.
- Synchronous Message (Solid Arrow head): Sender waits for response.
- Asynchronous Message (Half-stick Arrow head): Sender does not wait for response.
- Return Message (Dashed Arrow head): Returns control/result to caller.
4. Activity Diagram (Behavioral)
Work-flow diagram depicting operational activities, decision branching (<>), and parallel concurrency using Forks (split 1 flow into parallel flows) and Joins (merge parallel flows into 1 flow).
5. Statechart / State Machine Diagram (Behavioral)
Depicts state transitions of a single reactive object in response to discrete events throughout its lifecycle. Includes Initial State (filled circle), Transitions, and Final State (bullseye circle).