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.

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.

Purpose of Structural Models
Structural models represent:
Elements (Entities/Objects/Things): The concepts about which the system must capture, maintain, and process information.
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.,
Postgraduatestudent).Abstract Classes: Conceptual abstractions that organize shared attributes and behaviors. Abstract classes are never directly instantiated into runtime objects (e.g.,
Studentserving strictly as a parent superclass forUndergraduateandPostgraduate).
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.

Three-Compartment Class Structure
A UML class is drawn as a rectangle divided into three horizontal compartments:
Top Compartment (Class Name): Contains the class name typed in centered bold text. By convention, class names use PascalCase (e.g.,
Patient,AppointmentSystem).Middle Compartment (Attributes): Lists the properties that describe the state of an object instance.
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
Studentclass containingstudentID,name,DOB,phoneNo, andcourse(wherecourseincludescourseCode,courseName,level),courseis compound. It must be decoupled into a separateCourseclass 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:
/ageis calculated on demand usingDOBand 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:
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.

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:
Examples of Multiplicity Semantics
Department to Boss (): A department has exactly one boss.
Employee to Child (): An employee has zero to many children.
Boss to Employee (): A boss is responsible for one or more employees.
Dual Associations Between Same Classes: An
Employeeworks for exactlyDepartment( employees per department). Simultaneously, anEmployeeoptionally serves as head ofDepartment( to ).
Association Classes
When a many-to-many ( to ) association possesses attributes or operations that belong to the relationship itself rather than either connected class, an Association Class is formed.

Example: A
Studentcan enroll in multipleCourseinstances, and aCoursecontains multiple enrolledStudentinstances. Properties likemarkandgradebelong specifically to theenrolsInassociation 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 ().
Aggregation vs. Composition
Whole-part relationships model container classes composed of sub-components:
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
HealthTeamcontainsDoctor,Nurse, andAdminPerson. If theHealthTeamdisbands, individual personnel continue to exist in the system.
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
BuildingcontainsEntranceandExitpoints. 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.

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:
Structural Patterns: Focus on object composition and interface simplification (e.g., Façade, Adapter, Decorator).
Behavioral Patterns: Focus on dynamic communication, responsibility distribution, and object interaction (e.g., Observer, Mediator).
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
Facadeclass that wraps subsystem interactions. Clients execute operations through the façade, insulating them from internal subsystem changes.

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
Adapterclass implementing the requiredTargetinterface. The adapter translates requests into internal calls on the wrappedAdapteeobject ("glue code").

Adapter Elements
Target: Defines the domain-specific interface thatClientuses.Client: Collaborates with objects conforming to theTargetinterface.Adaptee: Defines the existing, incompatible interface needing adaptation.Adapter: ImplementsTargetand wraps an instance ofAdaptee. Calls toAdapter.request()are mapped directly toAdaptee.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
Decoratorobject that implements the same interface, intercepts requests, adds behavior, and forwards calls to the wrapped component.

Decorator Architectural Example: Window System

Window(<<interface>>): Declares core window operationsdraw()andgetDescription().SimpleWindow: Implements base plain window behavior.WindowDecorator: Abstract decorator holding an aggregation reference to aWindowinstance.HorizontalScrollBarDecorator,VerticalScrollBarDecorator: Concrete decorators overridingdraw()to render specific scrollbars before or after invoking the baseWindow.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
Subjectmaintains a collection of subscriberObserverreferences and broadcasts state changes via automated notification loops.

Observer Mechanics
Subject: Provides methods to attach (registerObserver()) and detach (unregisterObserver()) subscribers. ContainsnotifyObservers(), 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
Mediatorthat coordinates interactions betweenColleagueobjects.

Mediator Components
Mediator: Defines an interface for communicating withColleagueobjects.ConcreteMediator: Implements cooperative behavior by coordinatingConcreteColleagueinstances.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.

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.

Comprehensive Abstract Factory Architecture

FactoryProducer: Evaluates criteria and returns an instance ofAbstractFactory(BuildingFactoryorPaintFactory).AbstractFactory: Defines abstract creation interfaces (getBuilding(),getPaintCompany()).BuildingFactory: ExtendsAbstractFactoryto produce concreteBuildingobjects (Home,House,Hut).PaintFactory: ExtendsAbstractFactoryto produce concretePaintCompanyobjects (Asian,Berger,Nerolac).Client: Interacts exclusively with abstract interfaces, eliminating explicitnewkeyword 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 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 extendingCarriage):Attributes:
- maxLuggageWeight : double = 30.0Associations: Connects to
Passenger().
FreightCarriage(Abstract Subclass extendingCarriage):Attributes:
- cargoCapacity : double
FlatBedCarriage(Subclass extendingFreightCarriage):Associations: Carries
ShippingContainer().
HopperCarriage(Subclass extendingFreightCarriage):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 FoR codes.
Structural Class Representation
ResearcherClass:Attributes:
- name : String,- title : String,- position : StringRelationships: Associated with
University(), associated withFieldOfResearchCode().
UniversityClass:Attributes:
- name : String,- location : String
FieldOfResearchCodeClass: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 ().
Customers select many products for guests to choose from.
Multiple customers can include identical products across registries ().
Guests select one or more products to purchase on behalf of the registry organizer ().
Exercise 3: Movie Theatre Online Ordering System
System Description
A theater management system processes movies, tickets, and patrons:
MovieClass:- title : String,- producer : String,- length : int,- director : String,- genre : StringTicketClass:- price : double,- ticketType : String(Adult, Child, Concession),- showtime : DateTimePatronClass:- name : String,- age : int,- patronCategory : StringRelationships:
PatronbuysTicket();Ticketis issued forMovie().
Design Pattern Identification Exercises
Design Pattern Exercise 1

Scenario: Clients (
Client A,Client B) invoke simplified commands (bookTicket(),changeSeat()) on a centralBookingSystemclass, which handles complex interactions acrossTicket,Coupon,Flight,Seat, andPiecesOfLuggageclasses.Pattern Identified: Façade Pattern.
BookingSystemacts as the façade simplifying the complex airport management subsystem.
Design Pattern Exercise 2

Scenario: A
DrawingEditorinteracts with graphical elements conforming toShape(BoundingBox(),CreateManipulator()). To display text,TextShapeinherits fromShapeand delegates calls internally to an enclosedTextViewobject (GetExtent()).Pattern Identified: Adapter Pattern.
TextShapeacts as an adapter making theTextViewclass compatible with theShapeinterface.
Design Pattern Exercise 3

Scenario: Base
Icecream(make()) is realized byVanillaConeand extended byLuxIceCream.LuxIceCreamaggregates a reference back toIcecreamand is specialized byNuts(addNuts()) andSprinkles(addSprinkles()).Pattern Identified: Decorator Pattern.
LuxIceCreamserves as a decorator attaching extra ingredients dynamically to an existing base ice cream object.
Design Pattern Exercise 4

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

Scenario: An
Auctioneerreceives a new bid from a single bidder, processes the bid, and automatically broadcasts the updated highest bid to all participatingBidders().Pattern Identified: Observer Pattern. The auctioneer acts as the
Subjectbroadcasting price changes to bidderObservers.