UML class diagram briefly

Introduction

FIG class (Class diagram) is a static structure of the model, especially in the presence of model classes, the internal structure of classes and their relationships to other classes, and the like. FIG temporary class information is not displayed. FIG class is a major component of the object-oriented modeling. It is generally used for the application of the modeling concept classification system, but also for detailed modeling, model converted into programming code. FIG class may also be used for data modeling. --Baidu Encyclopedia

The beginning of a project, we often know nothing about the business, the most urgent issue we need to address is the reason clearly these business concepts and their relationships, if they can use good class diagram, you will be able to in-depth analysis systems business.

Of these six

  • inherit
  • achieve
  • Related
  • rely
  • combination
  • polymerization

1. Inheritance (Inherit)

Subclass inherits the parent class, subclass can be used for all non-private properties and methods of the parent class. In UML, inheritance solid line with an arrow with a hollow bar to represent

inherit

2. realization (Realization)

Implementation and inheritance is similar to the interface method implementation class inheritance, but by the class method must achieve their implementation. In UML, implemented with a white arrow of dotted line

achieve

As shown, micro-channel and have achieved SMS function qq

3. association (Association)

Is a relationship of association have, it makes a class knows another class attributes and methods; such as: student teacher, husband and wife may be associated with a bi-directional, it can be one-way. Bidirectional arrow association may be two or no associated arrow, there is a one-way arrow.

Related

4. dependent (the Dependency)

Refers dependent coupling between the class and class, a class dependency means depends on the definition of another class. In UML by a dotted line with an arrow.

rely

The composition (Composition)

Is a combination of association, it shows a strong "own" the relationship, reflecting the strict relationship between the parts and the whole, the parts and the whole life cycle of the same. In UML combining relationship indicated by a solid line in filled diamonds.

combination

6. polymerization (Aggregation)

Aggregation relationship is used to represent relationships between entities objects, represented by the partial semantic whole constituted by a plurality of, for example, a staff of the department. Combination relationship is different, and some are not strongly dependent on the whole, even if the whole does not exist, and some still exist. For example, the department revoked, people will not go away, they still exist. In UML aggregation relationship is represented by a solid line open diamond.

polymerization

end

Some programmers even partners around the class diagram can not read, in fact, this is very wrong.

Personally think that a class diagram is not complicated, a little spent a short time to understand what can be clear in mind, the preparation of design requirements for the project has a significant benefit.


Like you can focus on the public number: Lifelong Kindergarten

Guess you like

Origin juejin.im/post/5d021d59e51d45109725fe64