A summary of UML learning

Source: Internet
Author: User
Tags dashed line

Recently in the use of State mode to write a simulated Windows Calculator MFC program, the way to learn the UML diagram drawing, especially class diagram and state diagram of the drawing, here to summarize it.

I. INTRODUCTION of UML

Unified Modeling Language UML (abbreviation for Unified Modeling language): is a standard language used for visual modeling of software systems.

(1) in the development stage, UML is a design language used to illustrate, visualize, construct and write object-oriented software products. (2) UML can run through every stage of the software development cycle. Adopted by the OMG (Object Management organization) as an industry standard. (3) UML is most suitable for data modeling, business modeling, Object modeling and component modeling. (4) UML enables software developers to focus on building product models and structures.

When the model is established, the model can be converted into the specified program language code by UML tools.

At present, the main UML tools are: Rational company rose (rose), Together Soft Company's Together, Microsoft's Visio and so on.

Two, UML class diagram several relations

In UML class diagrams, the following relationships are common: generalization (generalization), implementation (realization), Association (association), Aggregation (Aggregation), composition (composition), dependency ( Dependency)

1. Generalization (generalization)

Generalization relationship: An inheritance relationship that represents a general and special relationship that specifies how subclasses can characterize all the characteristics and behaviors of a parent class. For example, the tiger is a kind of animal, that is, the characteristics of tigers have animals in common.

Arrow pointing to: Solid line with triangular arrows, arrow pointing to Parent class

2. Implementation (Realization)

Implement relationship: is a class-to-interface relationship that indicates that a class is an implementation of all the characteristics and behaviors of an interface.

Arrow pointing: Dashed line with triangular arrows, arrow pointing to Interface

For example: Pigeons (pigeon) are one of the birds that can implement a flying interface.

3. Association (Association)

Association: An owning relationship that enables a class to know the properties and methods of another class, such as: teachers and students, the relationship between husband and wife can be two-way or one-way. Two-way associations can have two arrows or no arrows, and one-way associations have an arrow.

"Code embodiment": member variable

Arrows and points: solid lines with normal arrows, pointing to the owner

4. Aggregation (Aggregation)

"Aggregation relationship": is the relationship between the whole and the part, and some can leave the whole and exist separately. If the car and the tires are the whole and part of the relationship, the tires leaving the car can still exist.

The aggregation relation is one kind of association relation, is the strong association relation, the Association and the aggregation cannot distinguish syntactically, must examine the concrete logical relation.

"Code embodiment": member variable

"Arrows and points": solid lines with hollow diamonds, diamonds pointing to the whole

5. Combination (composition)

"Combinatorial relationship": the relationship between the whole and the part, but part cannot leave the whole and exist alone. If the company and the Department is a whole and part of the relationship, no company there is no department.

A combinatorial relationship is a relationship that is stronger than the aggregation relationship, which requires that an object representing the whole in an ordinary aggregation relationship is responsible for the life cycle of the object that represents the part.

"Code embodiment": member variable

Arrows and points: solid lines with solid diamonds, diamonds pointing to the whole

6. Dependency (Dependency)

Dependency: A relationship that uses a class that requires the assistance of another class, so try not to use two-way interdependence.

"Code representation": A local variable, a parameter to a method, or a call to a static method

Arrows and points: dashed lines with arrows pointing to the user

The order of strength of the various relationships:

Generalization = implementation > Composition > Aggregation > Association > dependencies

The above summary of the UML class diagram is transferred from: http://blog.csdn.net/tianhai110/article/details/6339565, this blog also provides several kinds of graph relationship drawing method, the author uses VS2010 to draw, Of course, you can also use Rose, Visio tools to draw class diagrams.

A summary of UML learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.