MockExams

Object-Oriented Design (OOD), UML Class Diagrams & Architecture

AI draft, not yet reviewedUnit 3: Object-Oriented Design (OOD) & ArchitectureAbout 2 minutes

Idea in plain words

Tiered Architecture: Separating UI / Presentation Layer (console menu), Business Logic Layer (domain models), and Data Access Layer (file storage).

Exam tip

High-yield exam topic (Very High).

Explanation

Design bridges abstract analysis to concrete C++ implementation. Applying the Single Responsibility Principle (SRP) ensures that individual classes handle specific tasks (e.g., FileStorageManager handles persistence, while Account handles domain business validation).

Key points

  • UML Class Diagram: Standard diagrammatic notation showing class attributes (- private, # protected, + public), methods with signatures, and relationships.
  • Relationships: Association (uses), Aggregation (weak has-a, hollow diamond), Composition (strong has-a lifecycle dependency, filled diamond), Generalization (is-a inheritance, hollow triangle).
  • Sequence Diagrams: Temporal event flow between objects for primary operational workflows.
  • File Structure Architecture: Designing record structures with fixed byte lengths to support direct indexing.

Example

Example

Composition vs Aggregation: A Car has a mandatory Engine (Composition - Car owns Engine's lifetime). A Department has Professors (Aggregation - Professors exist independently if Department dissolves).

Code examples

// UML Class Representation to C++ Header Translation:
// +-----------------------------------+
// |             Account               |
// +-----------------------------------+
// | - accountNumber : int             |
// | # balance : double                |
// +-----------------------------------+
// | + deposit(amount : double) : void |
// | + withdraw(amount : double) : bool|
// | + getBalance() : double           |
// +-----------------------------------+

class Account {
private:
    int accountNumber;
protected:
    double balance;
public:
    Account(int acc, double initBal) : accountNumber(acc), balance(initBal) {}
    virtual void deposit(double amount) { balance += amount; }
    virtual bool withdraw(double amount) = 0; // Pure virtual
    double getBalance() const { return balance; }
    virtual ~Account() {}
};

Exam questions

  • [8 Marks] Draw a comprehensive UML Class Diagram for an Inventory Management System showing inheritance, aggregation, and visibility specifiers.
  • [7 Marks] Explain the difference between Composition and Aggregation with UML notation and equivalent C++ code snippets.

BIT156CO

Switch Course

Unit 1: Topic Selection, Feasibility Study & Project Proposal

Unit 2: System Requirements & Object-Oriented Analysis (OOA)

Unit 3: Object-Oriented Design (OOD) & Architecture

Unit 4: System Implementation & Coding in C++

Unit 5: Verification, Testing & Bug Fixing

Unit 6: Project Documentation & Final Viva Voce Defense

On this page

Past Exam Questions

Not asked in past exams yet

This topic hasn't appeared in previous exam papers.

Search BIT156CO

Reading

Theme
Reading mode
Text size
Default
Font
Line width
Line spacing