Class Models Flashcards
Class Models
A part of UML.
UML classes
Represented by a rectangle.
Class Model Objectives
- Build as quickly and cheaply as possible a system which satisfies our current requirements.
- Build a system which will be easy to maintain and adapt to future requirements.
Finding Classes
In order to find classes we rely on two different techniques:
- Data driven design
- Responsibility driven design
Data Driven Design
Identify all data of the system and divide it into classes. We then assign particular responsibilities to these classes.
Responsibility Driven Design
Identify all the responsibilities of the system and divide them into classes. We then find the data each class requires.
Association
Corresponds to verbs, and express relationships between classes.
Simple association is represented as an arrow between classes.
Multiplicity
Represents the type of relationships between classes, like a one to many relationship. For example, one student (class) can have many modules (class).
Attributes
Describe the data contained in an object of a class and their type.
Generalisation
UML way of saying inheritance.
CRC Cards
These contain:
- name of class at the top
- responsibilities of the class
- collaborators of the class
Limit responsibilities and collaborators to roughly two.
Types of association
Aggregation and composition.
Aggregation
Focuses on showing one to many relationships, and is more of a weak relationship, with the destruction of one not leading to the others destruction.
Represented with an open diamond.
Composition
Focuses on a strong relationship, with the destruction of the main class resulting in the destruction of the subclass.
Represented with a closed diamond.
Navigability
Shows which class is taking, or is taken by, the other class.
Qualified Associations
Provides finer details about associations.
Derived Associations
Like if (A,B) and (B,C) then (A,C).
Essentially, associations which are derived from other associations.
Constraints
Gives us conditions that must be satisfied by any correct implementation (like a XOR constraint).
Association Classes
Another way of helping us define associations, and is simply enough an association and a class, with the class helping to define the details of the association.
The usefulness behind this is that the class can be reused.
Interfaces
Can help us specify operations of some model element visible outside of out class.