Академический Документы
Профессиональный Документы
Культура Документы
Collaboration Diagram
State Diagram
Component Diagram
Use Case Diagrams
Borrow
Employee
Client
Order Title
Fine Remittance
Supervisor
employee
waitress
Use Case Diagram(core relationship)
or in MS Visio
(TogetherSoft, Inc)
Class Diagram
• Each class is represented by a rectangle subdivided into
three compartments
– Name
– Attributes
– Operations
• Modifiers are used to indicate visibility of attributes and
operations.
– ‘+’ is used to denote Public visibility (everyone)
– ‘#’ is used to denote Protected visibility (friends and
derived)
– ‘-’ is used to denote Private visibility (no one)
• By default, attributes are hidden and operations are
visible.
An example of Class
Account_Name Name
- Custom_Name
Attributes
- Balance
+AddFunds( ) Operations
+WithDraw( )
+Transfer( )
C++ Class Example
class Checking {
private:
string Customer_name;
float Balance;
public:
AddFunds(float);
WithDraw(float);
Transfer(float);
set_name(string);
get_name();
set_balance(float);
get_balance();
};
Notation of Class Diagram: association
• Uni-directional association
e.g. Order and item
notation:
Association: Multiplicity and Roles
student
1 *
University Person
0..1 *
employer teacher
Multiplicity
Symbol Meaning Role
Role
1 One and only one “A given university groups many
0..1 Zero or one people; some act as students, others
as teachers. A given student belongs
M..N From M to N
to a single university; a given teacher
* From zero to any positive integer may or may not be working for the
0..* From zero to any positive integer university at a particular time.”
1..* From one to any positive integer
Notation of Class Diagram: Generalization
Regular Loyalty
Customer Customer
Subtype1 Subtype2
or: Customer
Generalization expresses a
relationship among related
classes. It is a class that
includes its subclasses.
Regular Loyalty
Customer Customer
Notation of Class Diagram: Composition
COMPOSITION
Whole Class
Composition: expresses a relationship among
instances of related classes. It is a specific kind
Class W
of Whole-Part relationship.
Engine Transmission
Notation of Class Diagram: Aggregation
Container Class
Class C Aggregation: expresses a relationship among instances
of related classes. It is a specific kind of Container-
AGGREGATION Containee relationship.
Apples Milk
Sequence Diagram: Object interaction
A B
[condition] remove()
Condition
*[for each] remove()
Iteration
Self-Call
Sequence Diagrams – Object Life Spans
• Lifelines
The dotted line that extends down the
vertical axis from the base of each object.
• Messages
Labeled as arrows, with the arrowhead A
indicating the direction of the call.
Message
6: remove reservation
5: title available
6 : borrow title
1: look up
2: title data
4 : title returned
Catalog
5 : hold title
CRC Card
•A collection of standard index cards, each of which is
divided into three sections; can be printed or hand-written.
•Benefits: It is easy to describe how classes work by moving
cards around; allows to quickly consider alternatives.
Class Collaborators
Reservations • Catalog
• User session
Responsibility
• Keep list of reserved titles
• Handle reservation
How to create CRC cards?
• Find classes
Look for main classes first, then find relevant classes.
• Find responsibilities
Know what a class does; what information you wish to maintain about
it.
• Define collaborators
A class often needs to collaborate with other classes to get the job
done. Collaboration diagram is an example to show class relationship.
• Move cards around
Cards that collaborate with one another should be placed close
together, whereas cards that don’t collaborate should be placed far
apart.
Component Diagram
• Illustrate the organizations and dependencies of the
physical components in a system.
• Has a higher level of abstraction than a Class diagram
- usually implemented by one or more classes.
Symbols and Notations
Components
a large rectangle with two smaller rectangles on the side.
Component Diagram (cont.)
Interface
An interface describes a group of operations used or
created by components. It represents a declaration of
a set of coherent public features and obligations,
similar to a contract.
Dependencies
dashed arrows.
Component Diagram (cont.)
order
customer
account