1. Figure
2. Use copy diagram
a) Role: The function of the abstract system.
b) Inheritance (nanhemial) relationship: used to indicate the same interface, different implementation
I. 图:
Ii. Code:
Public interface customer {
Public void Buy ();
}
Public Class Retailcustomer IMPLEments Customer {
PRIVATE SHOPPING S;
Public RetailCustomer (Retailshopping RS) {
THIS.S = RS;
}
Public void Buy () {
s.buy ();
}
}
Public Class WholesaleCustomer Implements Customer {
PRIVATE SHOPPING S;
Public WholesaleCustomer (Wholesaleshopping WS) {
THIS.S = WS;
}
Pulbic void Buy () {
s.buy ();
}
}
Public interface shopping {
Public void Buy ();
}
Public class retailshopping imports shopping {
Public void Buy () {
Do Some Thing
}
}
Public class wholesaopping imports Shopping {
Public void Buy () {
Do Another Thing
}
}
c) Extended relationship: extended use case (calculation points), do not necessarily need to be executed.
I. 图:
Ii. Code:
Public class customer {
Private shoppping s;
Public void Buy () {
s.buy ();
}
}
Public class integral {
Public void countintegral () {
...
}
}
Public class shopping {
Private integral i;
Public void Buy () {
Do Some Thing
IF (...)
i.countintegral ();
Continue do something
}
}
d) Contains relationship: The use case (receivable) must be executed.
I. 图:
Ii. Code:
Public clas pain {
Public void pain () {
...
}
}
Public class retailshopping imports shopping {
PRIVATE PAIN P;
Public void Buy () {
...
p.PAIN ();
...
}
}
Public class wholesaopping imports Shopping {
PRIVATE PAIN P;
Public void Buy () {
...
p.PAIN ();
...
}
}
3. Class Diagram
a) Role: It can be used to describe the morphology of various objects in the system, and also describe the relationship between the system and classes in the system.
b) Interface:
i. Figure: II. Code:
Public interface itest {
Public void dothing ();
}
c) Class:
I. 图:
Ii. Code:
Public class test {
PRIVATE STRING NAME;
Public void dothing () {...}
}
d) Class implementation interface:
I. 图:
Ii. Code:
Public Class Test Implements ITEST {...}
e) class extension class:
I. 图:
Ii. Code:
Public Class Subtest Extends Test {...}
f) Class references other classes:
I. 图:
Ii. Code:
Public class test {
Private other;
...
}
G) Class Multi-values Reference Other Categories:
I. 图:
Ii. Code:
Public class test {
Private vector
...
}
4. Sequence Diagram
a) Role: Used to reflect the dynamic collaboration between several objects. Suitable for describing the time of time between objects. Can be used to assign responsibilities between objects.
b) A call itself:
I. 图:
Ii. Code:
Public class a {
Public void methoda1 () {
Methoda2 ();
}
Public void methoda2 () {...}
}
c) a mode of function:
I. 图:
Ii. Code:
Public class a {
Private B B;
Public void methoda1 () {
B.METHODB1 ();
}
}
d) a Call B acquisition method:
I. 图:
Ii. Code:
Public class a {
Private B B;
Public void methoda1 () {
C c = B.Methodb2 ();
}
}
PUBLIC CLASS B {
Public C Methodb2 () {
Return new c ();
}
}
5. State Machine Diagram
a) Role: It is a supplementary description of the things described in the class, and he shows all the objects of all objects that may have, and events that cause state changes. In addition to this, we can use a state machine diagram to describe an internal implementation and jump of a responsible method. The state diagram is more suitable for describing complex behaviors within a single class, and is not suitable for describing interaction behavior.
b) describe a HTML request
I. 图:
Ii. Code:
Public void dopost (..., ...) {
Extract parameters;
Boolean Result = HandleParameter ();
IF (Result)
Page = generatepage ();
Else
Page = generateErrorPage ();
Writer.write (PAGE);
}
6. Activity Diagram
a) Role: It is used to describe interactions between objects, but focus on the description of the work, focusing on the process described, rather than working. It is more good at describing the concurrency.
b) describe parallel task processing:
I. 图:
Ii. Code:
Public void Handletask (Task T) {
Subtask [] Sub = Deviedetask (T);
For (Subtask St: SUB)
New thread (st) .start ();
}
c) Describe bank withdrawals
I. 图:
Ii. Code:
Public void pickmoney () {
While (Queue! = EMPTY) {
...
}
GetMoney ();
}
7. Summary:
Figure
effect
Use case
Describe the functional requirements of the system
Class Diagram
Describe the properties and operations of the class
Flowchart
Describe the interaction between the class
State map
Describe the internal state changes of the class single class
Activity map
Execution process used to describe functions
When a system is implemented, we should start with an example drawing and analyze the function interfaces of the system should have. Then use the active diagram to find the implementation process of the function. Use the sequence diagram to perform function assignment, divide the responsibilities to the class, then use the class diagram, outline a class, when completing a particular function, the method and attributes should have, and finally use the state machine diagram, The implementation of the function is refined. Finally, encoding.