Software model design foundation - relationship

zhaozj2021-02-16  98

1.5 relationship

The relationship is the most difficult "piece" thing in UML (I think it yourself, but I don't know how to see it), it is difficult to analyze the key to the system architecture.

Regarding the relationship, I will explain in detail in the next chapter. In fact, software development carefully thinks about the description of real things, and this description is the relationship, and its real thing is Object.

The following describes several typical relationships in UML.

1.5. 1 Dependency

The change in one element (the provider of things that is dependent) will affect another element (relying on the recipient of things) or provide information to it (recipient). Regarding the semantics of dependence, I will give a simple example. A child (dependency) is a behavior that does not get food. His survival is to rely on his parents (depending on things) to his support (dependency). Therefore, dependence is defined as: One thing is dependent on the dependence of things in order to achieve a certain purpose.

The dependencies may be diverse, so we use dependencies to express it, in the form of different dependencies, depending on different variants

(Varieties): <1> Abstract: extract some features from an object and use the class method. <2> Binding: Specifies the value for template parameters to define a new template element. <3> Combination: The nature of different classes or packets is similarly fused. <4> Permission: Allows another object to access the object. <5> Usage: Declare that uses a model element to use another model element that exists, so that the user's functionality (including call, instantiation, parameter, transmission) is implemented. <6> Track: Declare some connection between the elements in different models. <7> Access or Connection: Allows a package to access another package. <8> Call (CALL): Declare a method of operating a class call to other classes. <9> Derive: Declare an instance can be exported from another instance. <10> Friend: Allow an element to access another element, regardless of the visibility of the elements being accessed. <11> Import: Allows a package to access the content of another package and increase the alias for access components. <12> Instantitate: An instance declaration of another class is created about a class. <13> Parameter: A relationship between an operation and its parameters. <14> Realize: Description and actual relationship. <15> Refine: The statement has a mapping between elements at two different semantic levels. <16> Send: The relationship between the signal sender and the signal recipient.

UML itself does not provide much definitions, the author adds some of the UML's understanding, which will be described in detail in the next chapter.

1.5.2 Association

The association is the relationship between two or more specific classes, which describes the connection of these types of instances. Participation is in order in the associated position. In one association, the same class can appear in multiple locations, and each instance chain associated is a collection of an organic sequence table, an associated epitaxy, is a collection of such a chain. A given object can occur multiple times in a chain collection, or in the case where the associated definition allows multiple times in the same chain (different position). Association will be organized together. If it is not associated, it is just a collection of connected classes. The association can have a name, but most of its description is built in the associated endpoint, each endpoint describes the participation of associated mid-class objects. The associated endpoint is only part of the associated description, not a semantic or available symbol representation.

The associated name is unique in all associations and classes containing the package. If the name is not unique, the associated endpoint is not clear. Associated endpoints define a class (role participation) in a given location in the associated location. The same class can appear in multiple locations, but the location is not exchanged, this location is related to the association? Quot; relationship. "Of course, the endpoint of the location can also be other cases.

In the semantics of UML, the relationship of the location (association) is called a chain. The chain can be created and destroyed during system execution, obey the restrictions of each associated endpoint variability (corresponding or related to the class itself).

The following related maps are two parameter classes. Simple association is that the processing of wool is implemented by the operator, and one operator can process a lot of wool, and the wool only requires one process in one step (not considering multiple steps) .

1.5. 3 Generalization

What is generalization? It is a broader element and a class between a more special element. More special elements completely contain a broader element and contain more information. Examples of more special elements can be used for any place where a broader element is used.

Ultrafining is the relationship between two similar elements (such as classes, packs or other elements), one of which is called a parent, and the other is a child. For classes, the parent class is called superclars, and the subclass is called subclasses. The direct instance of the parent class has a common feature of all subclasses, and the example explained by the child is the object of the above instance.

In the inheritance of class (herein, object-oriented programming in C or Java), the concept of generalization is widely used, in fact, so-called generalization is abstracting special things, mainly facing these things. Features, comparing these features and related things, the common feature is extracted, and the resulting results are the generalization characteristics of the matter we need to exhibit.

In the example of the class, one of the most common examples is the problem of graphics, such as describing triangles, or describing squares, or ellipses, etc., which are graphics, good, I have drawn from triangles, squares, ellipses, etc. , Describe it, this is described in a graphic (resulting from a triangular generalization).

Learning Java or C brothers look at it, the key to the problem is the relationship between base classes and inheritance. However, the generalization of the parameter class is a general class (this relationship is relatively blurred), and we will describe more detailed description in the relationship in the next chapter.

1.5.4 Implementation

1. Define how a thing is constructed, calculated. For example, the class is an implementation of type, and the method is the implementation of the operation. It is realized between implementation and instructions.

2. A step of describing system functions with executable media (such as programming language, database, digitized hardware). For implementations, the lower level of decision must be produced to make the design suitable for specific implementation and adapt to the environment (each language has its own limitations). If you are design well, you do not affect the overall system of the system. This step is captured by the realization layer model. Especially static views and code. Implementation is a relationship, is a model element (such as class) to another model element (such as an interface), where the interface is only a description of the behavior rather than the structure or implementation. Customers must support all of the providers (by inheritance or direct declaration). While achieving an explanation element such as an interface, it can also imply its description (not its implementation) must be supported by a specific implementation element. For example, this can be used to represent an optimization form of the class and a simple and inefficient formal relationship.

Utensilizing and implementing relationships can be associated with specific descriptions with specific descriptions. Ultrafining will be attached to the elements in the same semantic layer and in the same model. Relationships will be connected in different semantic layers, (interfaces or classes) and are typically built in different models.

Posted on July 30, 2004 11:30 am

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

New Post(0)