UML translation and learning note 1 - Class Diagrams (class diagram)

xiaoxiao2021-03-06  66

Class Diagrams (class diagram)

Class diagrams identify the class structure of a system, including the properties and methods of each class. Also depicted are the various relationships that can exist between classes, such as an inheritance relationship. The Class diagram is one of the most widely used diagrams from the UML specification. Part of the popularity of Class diagrams stems from the fact that many CASE tools, such as Rational XDE, will auto-generate code in a variety of languages, including Java, C , and C #, from these models. These tools can Synchronize Models and Code, Reducing Your Workload, And Can Also Generate Class Diagrams from Object-Oriented Code, for Those "Code-Ten-Design" Maintenance Projects.

Class maps describe a systematic class structure

,

Includes each class attribute and method

(

Member function

).

of course

,

He also describes the various relationships that may exist between individual classes.

,

Such as inheritance

.

Class diagram is

UML

The most use of the specifications in the specifications

.Uml

The reason why class diagrams can be so widely used in many

Case

Computer aided software design

)

tool

,

such as

Rational XDE can automate a variety of code according to class diagrams, including Java, C , and C #. These tools can achieve synchronization between models and code, reduce your working pressure, but also for those "code-then -design "Maintenance Engineering, generate class diagrams from the object-oriented code.

NOTATION (Mark)

The Elements on a class diagram area classes and the reason

Some elements in the class diagram are classes and some relationships between them.

Class

class

Classes are the building blocks in object-oriented programming. A Class is depicted using a rectangle divided into three sections. The top section is the name of the Class. The middle section defines the properties of the Class. The bottom section lists the methods of The class.

Class is the basic block in OOP. A class is represented by a rectangle divided into three parts. The part of the top layer represents the class name. The middle part is some attributes of the class (member variable). The bottom is a list of methods (member functions) .

Association

joint

An Association is a generic relationship between two classes, and is modeled by a line connecting the two classes. This line can be qualified with the type of relationship, and can also feature multiplicity rules (eg. One-to-one, one-to -Many, Many-to-Many) for the relationship. Union is the most general referlication between two classes, indicated by a straight line of two classes. This line can be Qualified by the type of contact. It can also represent some MultiPlicity rules (such as 1 pair 1, 1 to more, many more)

Composition

composition

If a class can not exist by itself, and instead must be a member of another class, then that class has a Composition relationship with the containing class. A Composition relationship is indicated by a line with a filled diamond.

If a class can't exist itself, be sure to exist as a member of another class, then this class is related to a constituent between the classes. (For example, Ferrari's Generator must be installed in his car). A constituent relationship is represented by a straight line with solid rhizome.

Dependency

rely

WHEN a class Uses Another Class, Perhaps as a member variable or a parameter, and so "depends" on what class, a dependency rellationship is formed. A dependency refirationship is indeed by a dotted arrow.

If a class is to use another class, it may be a member variable or a parameter, so this class is dependent on that class, a dependency is formed. A dependency is represented by a broken line with an arrow.

Aggregation

Aggregate, gather

Aggregations INDICATE A WHOLE-Part RELATIONSHIP, AND ARE KNOWN AS "HAS-A" RELATIONS. AGGREGATION RELATIONSHIP IIIDICATED BY A LINE with A HOLLOW DIAMOND.

The aggregation relationship represents an overall and part of the relationship, which can have a gathering relationship by two classes connected by "HAS-A". The aggregation relationship is expressed by a straight line with a hollow rhizome.

Generalization

Generalization

A Generalization relationship is the equivalent of an inheritance relationship in object-oriented terms (an "is-a" relationship). A Generalization relationship is indicated by an arrow with a hollow arrowhead pointing to the base, or "parent", class.

The inheritance relationship between the generalization and OO is equivalent, and there is such a relationship between the two classes connected by "IS-A". A general relationship is represented by an arrow with a hollow triangle, an arrow finger It is a parent class.

Consider the example of a veterinary system. Animals served, such as dogs and birds, are tracked along with their owners. The following diagram models a potential solution. Since dogs and birds are "a kind of" animal, we use a Generalization relationship. Now consider an example of a veterinary station. Small animals are taken care of, such as dog birds, they all come with their owners. The following picture model is a feasible solution.

It should be "a kind of" animal (but the dog will bite ~~~ `` `), we use a general relationship, which is a inheritance relationship.

If there is any improper translation, I hope that all the masters don't point out, I would like to thank you first.

转载请注明原文地址:https://www.9cbs.com/read-110685.html

New Post(0)