Comprehensive Study Guide: Structural Systems Modeling, Class Diagrams, and Object-Oriented Design Patterns

Core Foundations of Systems Modeling

Systems Analysis and Design requires modeling systems across multiple dimensions to capture their full behavior, functionality, and architectural layout. Every software system is characterized through three complementary perspectives:

  • Functional Models: Focus on the purpose and user interaction of the system by answering "What is it for?" Typical representations include Use Case Diagrams.

  • Behavioral Models: Focus on the dynamic execution and flow of data by answering "What does it do?" Typical representations include Activity Diagrams and Sequence Diagrams.

  • Structural Models: Focus on the static framework and architectural components of the system by answering "What is it made of?" Typical representations include Class Diagrams and Object Diagrams.

Systems Analysis and Design Lifecycle Timeline

Structural Modeling and Problem Domain Discovery

Structural modeling captures the static structure of an information system. Its primary goal is to discover the key data contained within the problem domain and transform it into a solution model represented by software objects.

Structural Modeling Domain Transformation

Purpose of Structural Models

Structural models represent:

  1. Elements (Entities/Objects/Things): The concepts about which the system must capture, maintain, and process information.

  2. Relationships: The static structural dependencies, associations, and hierarchies connecting those entities.

Conceptual Domains and Class Categorization

During analysis, systems analysts categorize classes based on their role within the system development lifecycle:

  • Application (Problem) Domain Classes: Focus on real-world entities directly related to the business problem (e.g., Patient, Appointment, Doctor, Student, Course, Enrolment).

  • Implementation (Physical) Classes: Introduced in later design phases to handle system infrastructure, performance, storage, and user interface concerns (e.g., UserInterface, DatabaseConnector, Button).

Classes are further differentiated by instantiation capacity:

  • Concrete Classes: Fully realized classes used directly to instantiate runtime objects (e.g., Postgraduate student).

  • Abstract Classes: Conceptual abstractions that organize shared attributes and behaviors. Abstract classes are never directly instantiated into runtime objects (e.g., Student serving strictly as a parent superclass for Undergraduate and Postgraduate).


Class Diagram Syntax, Attributes, and Operations

Class diagrams serve as the primary structural model in object-oriented analysis and design. A class diagram illustrates classes, their internal contents, and how they relate to one another.

Elements of Class Diagrams

Three-Compartment Class Structure

A UML class is drawn as a rectangle divided into three horizontal compartments:

  1. Top Compartment (Class Name): Contains the class name typed in centered bold text. By convention, class names use PascalCase (e.g., Patient, AppointmentSystem).

  2. Middle Compartment (Attributes): Lists the properties that describe the state of an object instance.

  3. Bottom Compartment (Operations): Lists the functions or behaviors that the class can execute.

Attribute Modeling Rules

  • Primitive vs. Compound Attributes: Attributes must be primitive or atomic data types (e.g., integer, real, string, boolean, date). A compound attribute containing multiple nested properties indicates a hidden entity and must be modeled as a distinct class with its own relationship.

    • Example: In a Student class containing studentID, name, DOB, phoneNo, and course (where course includes courseCode, courseName, level), course is compound. It must be decoupled into a separate Course class linked via an association.

  • Derived Attributes: Attributes calculated dynamically from other existing data fields rather than persistently stored. They are denoted by a leading forward slash (/).

    • Example: /age is calculated on demand using DOB and the current date. It appears on the class diagram to signal business relevance, and its formula is detailed in the data dictionary.

Operations Modeling Rules

Operations represent the actions or functional capabilities of a class. In later implementation stages, operations map directly to class methods in source code.

  • Analysis Phase Focus: Analysts document domain-specific operations (e.g., makeAppointment(), payBill(), checkAvailability()).

  • Omitted Operations: Standard implementation infrastructure (such as generic object constructors, destructors, getter accessors, setter mutators, or universally inherited methods) is omitted to maintain high-level clarity.

  • Syntax: Operations include trailing parentheses () which may enclose parameter names and types.

Encapsulation and Visibility Notation

Visibility controls accessibility to class members, supporting encapsulation and information hiding:

SymbolVisibility LevelAccess Scope+PublicAccessible and modifiable by any outside class.#ProtectedAccessible only by the class and its immediate subclasses.−PrivateHidden completely from all external classes.\begin{array}{|c|l|l|} \hline \textbf{Symbol} & \textbf{Visibility Level} & \textbf{Access Scope} \\ \hline + & \text{Public} & \text{Accessible and modifiable by any outside class.} \\ \hline \# & \text{Protected} & \text{Accessible only by the class and its immediate subclasses.} \\ \hline - & \text{Private} & \text{Hidden completely from all external classes.} \\ \hline \end{array}

  • Analysis Conventions: Default attributes to private (-) and operations to public (+). Specific access controls are finalized during design.


Relationships in Structural Modeling

Relationships describe structural connections between classes. UML defines three core relationship types: Associations, Generalizations, and Aggregations.

Types of Relationships in Class Diagrams

Association and Multiplicity Constraints

An association represents a structural relationship between two or more classes (or a class and itself). It is annotated with a verb phrase or role name indicating the nature of the connection.

Associations require multiplicity constraints at both ends to specify how many instances of one class can associate with a single instance of the related class:

Multiplicity NotationInterpretation1 or 1..1Exactly one instance0..∗Zero or more instances (optional many)1..∗One or more instances (mandatory many)0..1Zero or one instance (optional single)m..nSpecific numerical range from m to n inclusive\begin{array}{|c|l|} \hline \textbf{Multiplicity Notation} & \textbf{Interpretation} \\ \hline 1 \text{ or } 1..1 & \text{Exactly one instance} \\ \hline 0..* & \text{Zero or more instances (optional many)} \\ \hline 1..* & \text{One or more instances (mandatory many)} \\ \hline 0..1 & \text{Zero or one instance (optional single)} \\ \hline m..n & \text{Specific numerical range from } m \text{ to } n \text{ inclusive} \\ \hline \end{array}

Examples of Multiplicity Semantics
  • Department to Boss (1→11 \rightarrow 1): A department has exactly one boss.

  • Employee to Child (1→0..∗1 \rightarrow 0..*): An employee has zero to many children.

  • Boss to Employee (1→1..∗1 \rightarrow 1..*): A boss is responsible for one or more employees.

  • Dual Associations Between Same Classes: An Employee works for exactly 11 Department (1..∗1..* employees per department). Simultaneously, an Employee optionally serves as head of 11 Department (0..10..1 to 1..11..1).

Association Classes

When a many-to-many (0..∗0..* to 0..∗0..*) association possesses attributes or operations that belong to the relationship itself rather than either connected class, an Association Class is formed.

Association Class Concept
  • Example: A Student can enroll in multiple Course instances, and a Course contains multiple enrolled Student instances. Properties like mark and grade belong specifically to the enrolsIn association class, as they exist only for a specific student taking a specific course.

  • UML Notation: Drawn as a standard class box attached to the association line via a dashed line.

Generalization and Specialization

Generalization models an "is-a-kind-of" relationship, establishing hierarchical inheritance between a superclass (parent) and subclasses (children).

  • Generalization: Abstracting shared attributes, operations, and relationships from multiple classes into a common superclass.

  • Specialization: Creating sub-types that add specific attributes or operations unique to the child class.

  • Inheritance: Subclasses automatically inherit all attributes, operations, and associations defined on their superclass.

  • UML Notation: Drawn as a solid line pointing from the subclass to the superclass ending in a large open-headed arrow (→\rightarrow).

Aggregation vs. Composition

Whole-part relationships model container classes composed of sub-components:

  1. Shared Aggregation (Logical Whole-Part): Represents a container where component parts exist independently outside the parent lifecycle.

    • UML Notation: Drawn as a solid line with an open diamond at the container end.

    • Example: A HealthTeam contains Doctor, Nurse, and AdminPerson. If the HealthTeam disbands, individual personnel continue to exist in the system.

  2. Composition (Physical Whole-Part): Represents strong ownership where component parts cannot exist independently of the container parent.

    • UML Notation: Drawn as a solid line with a filled diamond at the container end.

    • Example: A Building contains Entrance and Exit points. Destroying the building eliminates those access points.


Object Diagrams vs. Class Diagrams

While class diagrams model the generic template of a system, an Object Diagram represents a static snapshot of concrete object instances and their specific attribute values at a precise point in time.

Class Instantiation to Object Instances
  • Notation Difference: Object names are underlined and formatted as instanceName : ClassName (e.g., aPatient : Patient).

  • Attribute Values: Displays explicit variable assignments (e.g., Name = Theresa Marks, Birthdate = March 26, 1965).

  • Utility: Object diagrams validate class models, test complex boundary cases, and visualize runtime object communication networks.


Introduction to Object-Oriented Design Patterns

A Design Pattern is a reusable, generalized solution to a recurring design problem within software architecture. Design patterns avoid reinventing solutions for common object-oriented structural, creational, and behavioral challenges.

Patterns are classified into three primary categories:

  1. Structural Patterns: Focus on object composition and interface simplification (e.g., Façade, Adapter, Decorator).

  2. Behavioral Patterns: Focus on dynamic communication, responsibility distribution, and object interaction (e.g., Observer, Mediator).

  3. Creational Patterns: Focus on object instantiation mechanisms, ensuring controlled creation processes (e.g., Singleton, Factory).


Structural Design Patterns

1. Façade Pattern

  • Problem: Client code must interact with a complex system containing many interdependent subsystems, resulting in high coupling and operational complexity.

  • Intent: Provide a unified, simplified, higher-level interface to an underlying complex subsystem.

  • Solution: Define a single Facade class that wraps subsystem interactions. Clients execute operations through the façade, insulating them from internal subsystem changes.

Without vs. With Facade Pattern
Façade Architecture
  • Client A, Client B: Call simple methods on the façade (method1(), method2()).

  • Facade: Encapsulates logic for routing requests to internal classes (Database, Model, Element).

  • Existing Subsystem: Continues operating independently without maintaining references back to the Façade.

2. Adapter Pattern

  • Problem: An existing third-party or legacy class provides required functionality but exposes an interface incompatible with client expectations.

  • Intent: Convert the interface of an existing class into a target interface expected by clients, enabling incompatible classes to collaborate.

  • Solution: Introduce an Adapter class implementing the required Target interface. The adapter translates requests into internal calls on the wrapped Adaptee object ("glue code").

Adapter Pattern Structure
Adapter Elements
  • Target: Defines the domain-specific interface that Client uses.

  • Client: Collaborates with objects conforming to the Target interface.

  • Adaptee: Defines the existing, incompatible interface needing adaptation.

  • Adapter: Implements Target and wraps an instance of Adaptee. Calls to Adapter.request() are mapped directly to Adaptee.specificRequest() without executing additional business calculation logic.

3. Decorator Pattern

  • Problem: An object requires additional responsibilities or behavioral variations dynamically at runtime, but using inheritance produces an unwieldy class hierarchy explosion.

  • Intent: Dynamically attach additional responsibilities to an object transparently without altering its core class hierarchy.

  • Solution: Enclose the component within a Decorator object that implements the same interface, intercepts requests, adds behavior, and forwards calls to the wrapped component.

Decorator Pattern Generic Structure
Decorator Architectural Example: Window System
Decorator Pattern Window Example
  • Window (<<interface>>): Declares core window operations draw() and getDescription().

  • SimpleWindow: Implements base plain window behavior.

  • WindowDecorator: Abstract decorator holding an aggregation reference to a Window instance.

  • HorizontalScrollBarDecorator, VerticalScrollBarDecorator: Concrete decorators overriding draw() to render specific scrollbars before or after invoking the base Window.draw() method.


Behavioral Design Patterns

4. Observer Pattern

  • Problem: A state change in one object requires updating an indeterminate, dynamic set of dependent objects without creating tight coupling.

  • Intent: Define a one-to-many dependency between objects so that when one object changes state, all its registered dependents are notified and updated automatically.

  • Solution: A central Subject maintains a collection of subscriber Observer references and broadcasts state changes via automated notification loops.

Observer Pattern Structure
Observer Mechanics
  • Subject: Provides methods to attach (registerObserver()) and detach (unregisterObserver()) subscribers. Contains notifyObservers(), which executes:

for observer in observerCollection:
    call observer.notify()
  • Observer: Defines the standard updating interface (notify()).

  • ConcreteObserverA, ConcreteObserverB: Implement update behavior to synchronize their state with the subject.

5. Mediator Pattern

  • Problem: Complex, direct inter-object communications cause tight coupling ("spaghetti code"), preventing individual objects from being modified or reused independently.

  • Intent: Encapsulate how a set of objects interact by forcing all communications through a central mediator object, promoting loose coupling.

  • Solution: Introduce a Mediator that coordinates interactions between Colleague objects.

Mediator Pattern Structure
Mediator Components
  • Mediator: Defines an interface for communicating with Colleague objects.

  • ConcreteMediator: Implements cooperative behavior by coordinating ConcreteColleague instances.

  • Colleague: Each colleague knows its mediator object and communicates exclusively with it rather than connecting directly to peer colleagues.


Creational Design Patterns

6. Singleton Pattern

  • Problem: System requirements dictate that exactly one instance of a class must exist globally (e.g., thread pool, logger, configuration manager), and accessible to multiple clients.

  • Intent: Ensure a class has only one instance while providing a global access point to that instance.

  • Solution: Declare a private constructor to block direct instantiation, store the single instance in a private static variable, and expose access via a public static getter.

Singleton Pattern UML Structure
Standard Java Implementation
public class Singleton {
    // Single private static instance
    private static final Singleton INSTANCE = new Singleton();

    // Private constructor blocks external instantiation
    private Singleton() {}

    // Public static global accessor method
    public static Singleton getInstance() {
        return INSTANCE;
    }
}

7. Factory Pattern (Factory Method and Abstract Factory)

  • Problem: A class must instantiate objects from complex class hierarchies without coupling itself to concrete classes or hardcoding exact class types.

  • Intent: Delegate object creation logic to dedicated factory classes or specialized factory methods.

  • Solution: Provide an interface for creating families of related or dependent objects without specifying their concrete classes.

Abstract Factory Pattern Structure
Comprehensive Abstract Factory Architecture
Abstract Factory Detailed Example
  • FactoryProducer: Evaluates criteria and returns an instance of AbstractFactory (BuildingFactory or PaintFactory).

  • AbstractFactory: Defines abstract creation interfaces (getBuilding(), getPaintCompany()).

  • BuildingFactory: Extends AbstractFactory to produce concrete Building objects (Home, House, Hut).

  • PaintFactory: Extends AbstractFactory to produce concrete PaintCompany objects (Asian, Berger, Nerolac).

  • Client: Interacts exclusively with abstract interfaces, eliminating explicit new keyword calls on concrete classes.


Practical Scenario Analysis and Exercises

Exercise 0: Train Simulation Domain Modeling

System Description

A mixed train carries people and goods using different carriage types. Every carriage possesses an ID number regardless of type. Passenger carriages carry passengers, who can bring up to 30 kg30\,\text{kg} of luggage. Freight carriages carry goods and are specialized into flat-bed carriages (which carry shipping containers) or hoppers (which carry raw materials).

UML Structural Design Breakdown
  • Carriage (Abstract Superclass):

    • Attributes: - idNumber : String

  • PassengerCarriage (Subclass extending Carriage):

    • Attributes: - maxLuggageWeight : double = 30.0

    • Associations: Connects to Passenger (0..∗0..*).

  • FreightCarriage (Abstract Subclass extending Carriage):

    • Attributes: - cargoCapacity : double

  • FlatBedCarriage (Subclass extending FreightCarriage):

    • Associations: Carries ShippingContainer (0..∗0..*).

  • HopperCarriage (Subclass extending FreightCarriage):

    • Attributes: - rawMaterialType : String

Exercise 1: Research Tracking System

System Description

New South Wales requires a tracking system for university researchers. Relevant attributes include researcher name, title, position, university name, location, and research interests. Research interests are chosen from a fixed list of numbered Australia and New Zealand "Field of Research (FoR) codes". Researchers can select up to 66 FoR codes.

Structural Class Representation
  • Researcher Class:

    • Attributes: - name : String, - title : String, - position : String

    • Relationships: Associated with University (1..∗→11..* \rightarrow 1), associated with FieldOfResearchCode (0..∗→0..60..* \rightarrow 0..6).

  • University Class:

    • Attributes: - name : String, - location : String

  • FieldOfResearchCode Class:

    • Attributes: - codeNumber : String, - description : String

Exercise 2: Gift Registry System

System Description

A department store gift registry system tracks customer information, target products, and guest lists.

  • Customers can own one or more registries (1→1..∗1 \rightarrow 1..*).

  • Customers select many products for guests to choose from.

  • Multiple customers can include identical products across registries (0..∗→0..∗0..* \rightarrow 0..*).

  • Guests select one or more products to purchase on behalf of the registry organizer (1..∗→1..∗1..* \rightarrow 1..*).

Exercise 3: Movie Theatre Online Ordering System

System Description

A theater management system processes movies, tickets, and patrons:

  • Movie Class: - title : String, - producer : String, - length : int, - director : String, - genre : String

  • Ticket Class: - price : double, - ticketType : String (Adult, Child, Concession), - showtime : DateTime

  • Patron Class: - name : String, - age : int, - patronCategory : String

  • Relationships: Patron buys Ticket (1→0..∗1 \rightarrow 0..*); Ticket is issued for Movie (0..∗→10..* \rightarrow 1).

Design Pattern Identification Exercises

Design Pattern Exercise 1
Design Pattern Exercise 1 Structural Diagram
  • Scenario: Clients (Client A, Client B) invoke simplified commands (bookTicket(), changeSeat()) on a central BookingSystem class, which handles complex interactions across Ticket, Coupon, Flight, Seat, and PiecesOfLuggage classes.

  • Pattern Identified: Façade Pattern. BookingSystem acts as the façade simplifying the complex airport management subsystem.

Design Pattern Exercise 2
Design Pattern Exercise 2 Class Diagram
  • Scenario: A DrawingEditor interacts with graphical elements conforming to Shape (BoundingBox(), CreateManipulator()). To display text, TextShape inherits from Shape and delegates calls internally to an enclosed TextView object (GetExtent()).

  • Pattern Identified: Adapter Pattern. TextShape acts as an adapter making the TextView class compatible with the Shape interface.

Design Pattern Exercise 3
Design Pattern Exercise 3 Class Diagram
  • Scenario: Base Icecream (make()) is realized by VanillaCone and extended by LuxIceCream. LuxIceCream aggregates a reference back to Icecream and is specialized by Nuts (addNuts()) and Sprinkles (addSprinkles()).

  • Pattern Identified: Decorator Pattern. LuxIceCream serves as a decorator attaching extra ingredients dynamically to an existing base ice cream object.

Design Pattern Exercise 4
Design Pattern Exercise 4 Control Tower Scenario
  • Scenario: An airport control tower coordinates navigation and flight paths between multiple approaching airplanes and helicopters without planes communicating directly with each other.

  • Pattern Identified: Mediator Pattern. The control tower functions as a central mediator encapsulating inter-aircraft flight interactions.

Design Pattern Exercise 5
Design Pattern Exercise 5 Auction Scenario
  • Scenario: An Auctioneer receives a new bid from a single bidder, processes the bid, and automatically broadcasts the updated highest bid to all participating Bidders (101,77,84101, 77, 84).

  • Pattern Identified: Observer Pattern. The auctioneer acts as the Subject broadcasting price changes to bidder Observers.