Documente Academic
Documente Profesional
Documente Cultură
Design Consideration
A class should have a single well focused
purpose.
A class should do one thing and perform it well.
Class
Operations
Methods
States
Attributes
Dependencies
Associations
Generalizations
Classes:
Identify the candidates for abstract super
classes by grouping classes that share
common attributes.
Use packages to look for classes that may be
missing.
is-analogous-to
Use is-analogous-to relationships to find missing superclasses.
is-part-of
Use is-part-of relationships to find other missing classes.
Relations
Find the list collaborations by examining the
responsibilities associated with classes.
Ask:
With whom does this class need to collaborate to
fulfill its responsibilities?
Who needs to make use of the responsibilities are
defined for this class?
Relations
Identify additional collaboration by looking for
these relationships between classes.
Is-part-of
The is-part-of relationship.
Has-knowledge-of
The has-knowledge-of relationship and.
Depends-upon
The depends-upon relationships.
Hierarchies:
Build Hierarchy graphs that illustrate the
inheritance relationships between classes.
Identify which classes are abstract and which
are concrete.
Draw Venn diagrams representing the
responsibilities shared between classes.
Hierarchies:
Construct class hierarchies using the following
guidelines:
Model a kind-of hierarchy.
Factor common responsibilities as high as possible.
Make sure that abstract classes do not inherit from
concrete classes.
Eliminate classes that do not add functionality.
Hierarchies:
Construct the contracts defined by each class
using the following guidelines:
Group responsibilities that are used by the same
clients.
Maximize the cohesiveness of classes.
Minimize the number of contracts per class.
Packages:
Draw a complete collaboration graph of the
system.
Identify possible subsystems within you
design.
Name the subsystems.
Look for frequent and complex collaborations.
Classes in a subsystem should collaborate to
support a small and strongly cohesive set of
responsibilities.
Class within a subsystem should be strong
interdependent.
Packages:
Simplify the collaborations between and within
subsystem.
Minimize the number of.
Collaborations a class has with other classes or subsystems.
Classes and subsystems to which a subsystem delegates.
Different contracts supported by a class or a subsystem.
Class Diagram
Class Diagram with Class Name only
Class Notation
Class describing the attributes and methods:
Rectangle
origin : Point
corner : Point
drawOn(context : DeviceContext) : void
includes(aPoint : Point) : Boolean
scaleTo(ratio : int) : void
Access Modifiers
When defining the attributes and methods use
following conventions
- for private
+ for public
# for protected
$ for class (static) also by underlining the classifier
/ for derived
An attribute whose value may be calculated based on the value of
other attributes.
Used to represent a value which is not persistence but used to hold
a transient value (Performance vs. Memory)
Generalization
Single Inheritance
Tool is the super class
Creation Tool and Selection Tool are subclasses
Tool
CreationTool
SelectionTool
Single Inheritance (Joint Notation)
CreationTool
EllipseCreationTool
RectangleCreationTool
LineCreationTool
TextCreationTool
Multiple Inheritance
Car
Ship
CarShip
Conjunction & Disjunction
Vehicle
Car
Ship
CarShip
Complete & Incomplete Hierarchy
Vehicle
Car
Ship
Association
has-knowledge-of
DrawingElement`
drawOn(DeviceContext context)
Drawing
Cardinality
Association are:
One to One
One to Many
Many to Many
Many to One
One to Optional
Optional to Many
One to Specified
Student
Role: Lears/Answers Attendence twords Teacher
Head Master
Role: Instructs/Pays twords Teacher
HeadMaster
Teacher
Ternary Association
Subject
Teacher
Class
Link Association
Subject
Teacher
Class
Schedule
Qualifier Assocation
Driver
hasLicense ()
Car
OR-Assocation
Driver
Owner
Car
hasLicense ()
{or}
Aggregation
Is-Part-of
Word
Sentence
Composition
Whole-of
TitleBar
Window
Dependency
Depends-on
Design
Analysis
Meta
Instance-of
Class
CreationTool
Instance
DrawingElement
Checkpoints
Classes
Clear Class names (Matches role)
One well-defined abstraction (if not split)
Functionally coupled attributes/behavior (look for
proper cohesion)
Generalization were made
All class requirements were addressed
Demands are consistent with state diagrams
Complete class instance life cycle is described.
The class has the required behavior
Checkpoints
Operations
Checkpoints
Attributes
A single concept
Descriptive names
All attributes are needed by use case realizations
(Remove if not required or duplicate)
Relationships
Descriptive role names
Multiplicities are correct