Structural Modeling


Structural modeling represents the static aspects of a system by focusing on describing the system objects and their relationships. Unlike functional models that represent behavior, structural models capture the essential elements like people, places, and things within the system.

Classes, Attributes, and Operations

Classes are the fundamental building blocks of structural models and consist of three main elements:

Relationships

There are three fundamental types of relationships in UML:

  1. Generalization
    • Represents "a-kind-of" relationships
    • Enables inheritance of attributes and operations
    • Example: A savings account is a kind of bank account
  2. Aggregation
    • Represents "a-part-of" relationships
    • Shows how parts relate to wholes
    • Example: A wheel is part of a car
  3. Association
    • Represents general relationships between classes
    • Usually weaker than aggregation
    • Example: A student enrolls in a course

CRC Cards

CRC (Class-Responsibility-Collaboration) cards are physical or digital index cards used to document:

Front
ex/Pasted image 20241109130813.png

Back
ex/Pasted image 20241109130828.png

Class Diagrams

Notation

../../UAS S4/CR/ex/Pasted image 20240624162353.png

Access Modifiers

ex/Pasted image 20241027170453.png|300

Relations (Arrows)

ex/Pasted image 20241027170539.png

Association

Class1 and Class2 is related in some way
Can also have a no fill arrow to show the direction
ex/Pasted image 20241027170558.png

Inheritance

SubClass1 and SubClass2 both inherit from SuperClass
ex/Pasted image 20241027170614.png

Aggregation

Class1 is part of Class2
(The one with the diamond is part of, the aggregated)
ex/Pasted image 20241027170630.png

Composition

Class1 cannot exist without Class2 and vice versa
ex/Pasted image 20241027170648.png

ex/Pasted image 20241027170716.png

Seven Steps to Structural Models

  1. Create CRC Cards
    • Document initial classes and responsibilities
    • Identify collaborations
  2. Review CRC Cards
    • Look for missing elements
    • Validate relationships
  3. Role-play the CRC Cards
    • Simulate scenarios
    • Identify gaps and issues
  4. Create the Class Diagram
    • Transform CRC cards into formal notation
    • Add relationships and multiplicities
  5. Review the Class Diagram
    • Remove unnecessary elements
    • Simplify where possible
  6. Incorporate Patterns
    • Apply known solutions to common problems
    • Leverage existing designs
  7. Review and Validate
    • Check against requirements
    • Verify with stakeholders