Class and Diagram Representation of Class Name Attributes Operations Visibility of Attributes and Operations
Relationship or Notation of class diagram Generalization Association Composition Aggregation
Used for describing structure and behaviour in the use cases. Provide a conceptual model of the system in term of entities and their relationship.
The top part contain the name of the class. It is printed in Bold, centred and the first letter capitalized.
The middle part contains the attributes of the class. They are left aligned and the first letter is lower case.
The bottom parts gives the methods or operations the class can take or undertake. They are also left aligned and the first letter is lower case.
“+” is used to denoted Public visibility (everyone) “#” is used to denoted Protected visibility (friends and derived) “-” is used to denoted Private visibility (no one)
By default, attributes are hidden and operations are visible. The last two compartments may be omitted to simplify the class diagrams
Account Name -Customer Name - Balance +add Funds() +with Draw() +transfer() Name Attributes Operations
There are two kinds of Relationships Generalization (parent-child relationship) Association (student enrols in course) Association can be further classified as Aggregation Composition
Generalization express a parent/child relationship among related classes. Used for abstracting detail is several layers Example Super type supertype1 supertype2
Association represent relationship between instances of class. An association is a link connecting two classes. Bi-directional association Association are assumed to be bi- directional e.g. Flight and place Notation:
Uni-directional association e.g. Order and item Notation:
EXAMPLE: Student Department Course
Composition: express a relationship among instances of related classes. It is specific kind of Whole-Part relationship It expresses a relationship where an instance of the whole-class has the responsibilities to create and initialize instances of each Part-class.
EXAPMPLE OF COMPOSITION Legs Hands Person Automobile Engine Transmission
Aggregation: express a relationship among instances of related classes. It is a specific kind of Container Containee relationship. It express a relationship where an instance of the Container-class has the responsibility to hold and maintain instances of each Containee-class that have been created outside the auspices of the Container-class.
EXAMPLE OF AGGREGATION Employee Company
THANK YOU