UML Learning Notes

Source: Internet
Author: User

This semester is lucky to choose to chapter Teacher's UML Fine Course, although to present only class two weeks, but the income is shallow. Although in the undergraduate contact with the UML, but do not have a very detailed understanding of it, but some of the names of some of the figures have been heard, did not delve into its function.

On the recent knowledge, talk about my general understanding of UML Unified Modeling Language, software engineering as an engineering discipline, as in the architectural disciplines, when we need to build a building, we need to carry out demand and design, in the construction, we need some design drawings, For example, the specific design of each room, three-dimensional view, etc., through these drawings for construction. The same is true of software engineering, when we get a project, not directly start coding, but before this a series of requirements analysis and detailed design,UML in the detailed design has been widely used, we use UML to draw the class diagram, use case diagram, time series diagram, As a basis for deployment diagrams, as well as the corresponding coding according to these charts, these diagrams drawn in UML are like design drawings in the construction industry, which are codingby the standard of these drawings. UML Drawing tools are mainly Visio 2007, the main development tools are:Star UML, IBM Rational rose,rsa and so on.

Here are some of the more commonly used UML Diagrams for some detailed introduction (this blog post highlights the class diagram):

First, class diagram

We know that object-oriented has three main features: encapsulation (abstraction), inheritance, and polymorphism, objects are instantiated as classes, which are well represented by class diagrams, which are also the most commonly used UML diagrams, often See the class diagram to understand the relationships between the various classes and the properties that are in each class, and in some software, you can generate the corresponding code from the class diagram generation. So the class diagram is widely used in software engineering. Here are some basic uses of class diagrams,

1. Class

, a class consists of three parts: the class name, the attribute, and the method composition. Where the properties and methods have a certain scope, public with + means,private - to express, protect in # indicates that the package uses ~ .

2. The relationship between classes and classes

1) Association (Association Relationship)

Usually with straight lines (interconnected) or (direct association), there is a difference between the correlation and the direct association, such as a B can indicate that class A knows the properties and methods of class B , and class B can also know class a properties and methods, but a direct association AB can know the properties and methods of class b , but by b You cannot know the properties and methods of a . is a one-way association, an interrelated implementation may need to be implemented using pointers.

2) Aggregation (aggregation relationship)

Aggregations can be seen as a strength association that describes the overall to local relationship. When we do not know whether the relationship between the two classes is an association or an aggregation relationship, the association relationship is generally used. The representation symbol is:

Or

3) Composition(combined relationship)

The strength of the composite relationship is stronger than the aggregation relationship, such as the car by the engine and so on, the engine as a part of the car, you can see that the life cycle of the subclass instance depends on the life cycle of the parent class. The representation symbol is:

Or

4) Generation( generalize)

A generalized relationship represents a class-to-Class inheritance relationship, which refers to the parent class, such as the animal class , which can generalize the cat class,which is thecat class animal an inheritance of the class. Indicates that the symbol is

5) Dependency (dependency)

As the name implies, a dependency represents a class that relies on the definition of another class, so the dependency is one-way. The representation symbol is:

6) Realization( implementation)

Primarily for interface, similar to inheritance relationships. The representation symbol is:

There are six kinds of relationship between class and class, we can judge the relationship between classes according to the actual situation, if some relationships are not certain, we could set up the correlation relationship in the design of class diagram and then make corresponding modification later, in addition we can set the correspondence between the instantiated objects in these relationships.

0..1

0 or 1 x

1

Only 1

0..*

0 or more

1..*

1 or more

Finally, we recommend a reference book "UML2 and theUnified Process: practical object-orientedanalysis and Design" Also attached to the class of shorthand notes (shorthand is only part of the focus >_<):

UML Learning Notes

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.