Object-Oriented Design (OOD)
Definition
Object-Oriented Design is a design strategy that structures the software as a collection of interacting objects, each bundling together data (attributes) and behavior (methods), modeled after real-world entities in the problem domain.
Four Pillars of OOD
1. Encapsulation
Bundling data and the methods that operate on it into a single unit (object/class), hiding internal details from the outside — exposes only a public interface.
2. Inheritance
A class (subclass) can inherit attributes and behaviors from another class (superclass), enabling code reuse and hierarchical classification.
3. Polymorphism
The ability for different classes to be treated through a common interface, with each providing its own specific implementation of a shared method.
4. Abstraction
Modeling only the essential characteristics of an object relevant to the problem, hiding unnecessary complexity.
OOD Process (High-Level Steps)
- Identify objects/classes from the problem domain (often nouns in the requirements)
- Identify relationships between classes: Association, Aggregation, Composition, Inheritance
- Define attributes and methods for each class
- Model dynamic behavior — how objects interact over time (sequence diagrams, state diagrams)
- Refine the design — apply design patterns, ensure encapsulation and low coupling
UML Diagrams Used in OOD
- Class Diagram — structure: classes, attributes, methods, relationships
- Use Case Diagram — system functionality from user perspective
- Sequence Diagram — interaction/message flow between objects over time
- State Diagram — object lifecycle/state transitions
Advantages of OOD
- Maps naturally to real-world entities — intuitive modeling
- Reusability through inheritance and composition
- Maintainability — encapsulation localizes changes
- Well suited to large, complex, evolving systems
Disadvantages
- Steeper learning curve than function-oriented design
- Can lead to over-engineering (unnecessary class hierarchies) if misapplied
- Performance overhead in some contexts vs. procedural code
OOD vs. Structured (Function-Oriented) Design
| Structured Design | Object-Oriented Design |
|---|---|
| Separates data and functions | Bundles data and behavior together |
| Top-down decomposition of functions | Bottom-up composition of objects |
| DFD → Structure Chart | Use Cases → Class/Sequence Diagrams |
Exam tip: Know the 4 pillars (Encapsulation, Inheritance, Polymorphism, Abstraction) with one-line definitions — this is one of the most reliably asked questions across the entire syllabus.