UML
UML
- Details
- Category: Design
- Published Date
- Written by Administrator
- Hits: 558
Class diagrams
Class
A class has a name, fields and operations
A class is NOT an object, objects are instances of classes
Each field or method has a visibility: public, protected, private or package internal
Association
Expresses: "Class A has a relationship with Class B"
An association might be directed and/or have a multiplicity/cardinality
Aggregation
Expresses: "The whole "comprises" the parts", "The parts "belong to" the whole"
Destroying the "whole" does not destroy the parts
The parts may be shared with other classes
Composition
Expresses: "The whole "has"/"contains" the parts", "The parts "are member of" the whole"
The parts are destroyed along with the "whole"
A composition is an aggregation and
Note about association/aggregation/composition
An aggregation and a composition are both more specific cases of an association
A composition is a strong relationship of the parts to the whole, if the parts can live without the whole, use an aggregation
Inheritance
Class inheritance
Expresses: "The derived class "is a" base class"
The base class generalizes/abstracts the derived classes
Derived classes specialize/extend the base class
Interface inheritance
Expresses: "The derived class "behaves like" the interface"
The interface is a specification/contract/behaviour for the class
The classe implements the behaviour of the interface
Use case diagrams
Actor
Actually a role taken on by some actor
Use case
Actions accessible to specific actors
Example
The rules for associations are similar to the ones of class diagrams

