UML class diagram induction

  As a programmer, to master UML class diagram is the basis for developing and reading programs.

  Reproduced please specify address http://www.cnblogs.com/zrtqsk/p/3739288.html, thank you!

First, the basic introduction

  UML is a standard graphical modeling language. The class diagram shows, the relationship between them is a set of classes and interfaces cooperation. UML class diagram is a graphical representation of a static view of the way through it, the relationship between the programmer can understand more clearly the class and class system.

  The basic model element class diagram is as follows:

  

  We can see, a class diagram showing a rectangular, divided into three parts, the top is the name of the class, the middle class is a property, the following is the operation of the class.

  Abstract classes and interfaces and class diagram is similar, the detailed explanations.

 

Second, the basic definitions

1, property

  Figure:

Attribute represented by the above general format - <Access> <attribute name>: <attribute type> = <Initial value>

For Visibility: + indicates public, - represent private, # represents protected, no symbol indicates the default package access

(If only internal use a class attribute, generally referred to as Attribute. If provided corresponding get, set method, generally referred Property)

 

2, method

  Figure:

The method described above is represented by the general format - <Access> <method name>: (<parameter 1>: <1 Parameter type>, <parameter 2>: <Parameter Type 2>): <return type>

Static methods are underlined.

Abstract method, the entire operations are shown in italics.

 

3, classes and interfaces

Abstract class interfaces ,

Abstract classes and interfaces are in italics class name, the interface can also be represented by a circle.

 

Third, the relationship

1. Related

Association generally represented by a straight line.

  1) Ordinary associate

  

  - with an arrow indicates the direction of the association.

  - numbers in the figures represent the number of weight

    0..1 object represents 0 or 1

    0 .. * denotes 0 or 0 to a plurality of objects

    5..8 objects represents 5-8

    2 shows two objects

    No mark represents a target

  2) recursive association

  

  Represent a class of their own and have relationships.

  3) aggregation association

  

   It represents a class and class have a relationship, "and the integral portion" represents a whole by a hollow diamond.

  4) Synthesis of the relationship (strong polymerization)

  

  Represents part of the whole can not be divorced exist. An overall with a solid diamond.

 

2, generalization (inheritance)

By adding a solid line arrow indicates a hollow, one of the inherited point inherited side.

 

3, to achieve

     

 

 

 

 

 

 

Plus a broken line with hollow arrows, one pointing implement the interface.

 

4, dependence

Represented by a dotted arrow. That class Client uses RightDao and RightDaoImpl.

 

(Refer to part "Design polishing mode")

Reproduced in: https: //www.cnblogs.com/zrtqsk/p/3739288.html

Guess you like

Origin blog.csdn.net/weixin_33675507/article/details/93248527