"Big Talk design mode" note-basic knowledge 1:UML class Diagram basics

Source: Internet
Author: User

a lot of computer technology books or articles commonly used in UML class diagram, the author of the book describes each design pattern is the class diagram + Object-oriented language applet ( in C #, its basic knowledge of a different article)+ character dialogue interpretation of knowledge points. This paper introduces the basic knowledge of UML class diagram used in "Big talk design mode".

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5B/79/wKioL1UKQUWDNO2vAAHenimwBvI629.jpg "title=" QQ picture 20150319110648.png "alt=" Wkiol1ukquwdno2vaahenimwbvi629.jpg "/>

is a picture of the whole, especially to pay attention to the various styles of arrows, the following sections with local small map to explain the knowledge points.

    1. Class

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5B/79/wKioL1UKQXLRPBtlAABJWxoTGco878.jpg "title=" QQ picture 20150319110948.png "alt=" Wkiol1ukqxlrpbtlaabjwxotgco878.jpg "/>

The class diagram is divided into three layers:

(1) The class name, if it is an abstract class, is marked with italics. In this case, the class name is "Animal" and it is an abstract class.

(2) class attributes, usually fields and properties. In this case, the class attribute is "alive".

(3) A class operation, usually a method or behavior. In this case there are two, one is the "metabolic" with parameters, the other is without parameters

"Breeding".

note the preceding symbol: '+' denotes public, '-' denotes private, '#' indicates protect. The class properties and class operations for this example are public .

2. Interface

Two kinds of notation.

(1)

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5B/7F/wKiom1UKQHyhmesUAACamBOSMmk644.jpg "title=" QQ picture 20150319111005.png "alt=" Wkiom1ukqhyhmesuaacambosmmk644.jpg "/>

(2) "Lollipop" notation

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5B/79/wKioL1UKQbmwrHqdAACT6Ix2idU614.jpg "title=" QQ picture 20150319111019.png "alt=" Wkiol1ukqbmwrhqdaact6ix2idu614.jpg "/>

3. Relationship

Between a class and a class or between a class and an interface

(1) inheritance relationship: Hollow triangle + solid line, the triangle points to the parent class.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5B/79/wKioL1UKQdHDa9I8AABZMjD1Qls061.jpg "title=" QQ picture 20150319111035.png "alt=" Wkiol1ukqdhda9i8aabzmjd1qls061.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5B/7F/wKiom1UKP-iBUbByAABR96Yn-3o934.jpg "title=" QQ picture 20150319111048.png "alt=" Wkiom1ukp-ibubbyaabr96yn-3o934.jpg "/>

(2) Realization of the relationship: with the hollow triangle + dotted line, the triangle is pointing to the interface.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5B/79/wKioL1UKQeejDv3oAABN4RDDUgg411.jpg "title=" QQ picture 20150319111105.png "alt=" wkiol1ukqeejdv3oaabn4rddugg411.jpg "/> 650) this.width=650;" src= "http:// S3.51cto.com/wyfs02/m02/5b/79/wkiol1ukqfwx-ovqaabw9jk6vke857.jpg "title=" qq picture 20150319111115.png "alt=" Wkiol1ukqfwx-ovqaabw9jk6vke857.jpg "/>

(3) Association Relationship (Association): with a solid line arrow, the arrow table is the direction, two-way no arrows.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5B/7F/wKiom1UKQODwRgjhAACc_FHSlaw475.jpg "title=" QQ picture 20150319111126.png "alt=" Wkiom1ukqodwrgjhaacc_fhslaw475.jpg "/>

Represents a strong dependency of two classes, or the semantic level between classes and interfaces, such as me and my friends; this relationship

The contingency, the relationship is not temporary, is generally long-term, and the relationship between the two sides is more powerful than the dependence.

is generally equal, the association can be one-way, two-way. In this case, penguins have a one-way relationship with the climate and penguins need to know.

(4) aggregation relationship (aggregation): With the Hollow diamond + solid line arrows, Diamond point to the aggregation end.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5B/79/wKioL1UKQhyDiL8PAABSuH1v5f4522.jpg "title=" QQ picture 20150319111145.png "alt=" wkiol1ukqhydil8paabsuh1v5f4522.jpg "/>650) this.width=650;" src= "/HTTP/ S3.51cto.com/wyfs02/m01/5b/7f/wkiom1ukqp_z9mmhaabgxtfr7yo783.jpg "title=" qq picture 20150319111159.png "alt=" Wkiom1ukqp _z9mmhaabgxtfr7yo783.jpg "/>

aggregation represents a weak "owning" relationship, which reflects A can have b, theB object is not part of a object. In this case a is a wild goose

Group, B is a wild goose. Their life cycle is not the same, there is no inevitable connection.

(5) synthesis Relationship (composition also called Combinatorial relationship): with solid diamond + solid line arrows, Diamond point to the whole part.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5B/7F/wKiom1UKQQ7SiWQ0AADMH0yXICw907.jpg "title=" QQ picture 20150319111210.png "alt=" Wkiom1ukqq7siwq0aadmh0yxicw907.jpg "/>

Synthesis represents a strong "owning" relationship, and the relationship between the strict part and the whole, the life cycle is consistent. In this case, the wings are

Part of the bird.

(6) dependency Relationship (dependency): With dashed arrows, arrows point to objects that are dependent.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5B/7F/wKiom1UKQSixKd8iAAClWQk7kuc674.jpg "title=" QQ picture 20150319111226.png "alt=" Wkiom1ukqsixkd8iaaclwqk7kuc674.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5B/7F/wKiom1UKQTmBmwmJAABj5Vovp6A164.jpg "title=" QQ picture 20150319111238.png "alt=" Wkiom1ukqtmbmwmjaabj5vovp6a164.jpg "/>

two mutually independent objects, objects the existence of a must depend on B. In this case,a is an animal,B has two oxygen and water. end of life of B

the A must end, or vice versa.

You can also understand this: a class A is used for another class B, which is contingency, temporary, and very weak, but changes in class B affect a.


"Big Talk design mode" note-basic knowledge 1:UML class Diagram basics

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.