Chapter 4 Static View

zhaozj2021-02-16  46

4.1 Overview The static view is the basis of UML. The elements of the static view in the model are meaningful concepts in the application, including the concept of the concept, abstract concept, realization concept and computer field, that is, various concepts in the system. For example, the ticket system of an theater has various concepts, such as tickets, reservations, reservation plans, seat allocation rules, online bookings, and redundancy information. A static view illustrates the structure of an object. An object-oriented system unifies a data structure and behavior feature into a separate object structure. Static views include all traditional data structural ideas, and also include the organization of data operations. Data and operations can be quantified as classes. Based on object-oriented perspectives, data and behavior are closely related. For example, Ticket objects can carry data, such as prices, performance dates, seat numbers, which can also have its operation, such as reserved this ticket or calculate its price with a certain discount. Static view describes behavior entities into discrete model elements, but does not include their dynamic behavior details. Static views Align these behavior entities as objects that will be specified by the class, have and used. Dynamic behavior of these entities is described by other views describing their internal behavior details, including interactive views, and state charts. Dynamic maps require static views to describe things that dynamically interact - if you don't know what is interactive, you can't make it clear how you clear your interaction. Static view is the basis for establishing other views. The key elements in the static view are the relationship between the class and their. Cyrids are modeling elements that describe things. There are several types of metals, including classes, interfaces, and data types. Other types including use cases and signals are embodied in behavioral things. The implementation is destined in several types of elements like subsystems, components, and nodes. In order to facilitate the reusability of understanding and model, large models must be composed of smaller units. Package is a general organizational unit that has and manages the model content. Any element can be owned by the package. The model is used to describe the package of the complete system view, and use or less independent of other models - this is the basis of graving a more detail of the description system. The object is the discrete unit separated from the model understanding and constructing the structure. It is an example of a class - the object is a recognizable state, the behavior of this state can be excited. It is an individual with identity by a structure and behavior. The relationship between the class is related to the link, generalization, and various dependencies, including implementation and use. 4.2 Category dollars are discrete concepts in the model, with identity, status, behavior, and relationships. There are several types of metades including classes, interfaces, and data types. Several other types of yuan are behavioral concepts, environmental things, and implementation structures. These types include use cases, participants, components, nodes, and subsystems. Table 4-1 lists several classes and their functions. The meta-model terminology includes all of these concepts because classes are the terms we are most familiar, so discuss it first, then define other concepts according to the differences between classes and other concepts.

Table 4-1 Various categories 1. Category representing discrete concepts in the model of modeling - physical entities (such as aircraft), commercial things (such as an order), logic (such as broadcast plan), application (Such as cancellation), things in the computer (such as a hash table) or behavior (such as a task). Class is a descriptor of a set of objects with the same structure, behavior, and relationship. The properties and operations used are attached or otherwise. Class is the core of object-oriented system organizational structure. Objects are discrete entities with identity, state, and covilive behavior. Objects are individuals used to construct an individual of actual operating systems; classes are used to understand and describe individual concepts of many individual objects. Category defines a set of objects with status and behavior. Properties and associations are used to describe the state. Attributes typically use pure data values ​​without identity, such as numbers and strings. Association is represented by the relationship between the identity object. Individual behavior is described by the operation, the method is the implementation of the operation. The life of the object is described by the state of the addition to the class. The representation of the class is a rectangle consisting of a tits, attribute, and operation. As shown in Figure 4-1. Figure 4-1 Class representation A group of classes can be used in general state and behavioral descriptions with generalization relationships and inheritance mechanisms established in it. Ultrafining makes more specific classes (subclasses) associated with more common classes containing several sub-belongings. A class can have zero or more parent classes (superclars) and zero or multiple processes (subclats). A class inherits state and behavioral description from its duplex and ancestors, and defines the status and behavioral description of its future generations. Class has a unique name in its included, which may usually be a package but sometimes may be another class. The class is visible to it, visible explains how it is located outside of its visible class. Multipleness of the class explains how many examples can exist, usually, may have multiple (zero or more, not clearly limited), but one instance is only one class in the execution process. 2. The interface interface is a description of the object behavior without gives the implementation and status of an object. The interface contains operation but does not contain attributes, and it does not associate an external world. One or more classes or components can implement an interface and each class can implement the operation in the interface. 3. The data type data type is used to describe the simple data value of the missing identity. Data types include numbers, strings, enumerated values. The data type passes the value and is an immutable entity. The data type is not attribute, but it can be operated. The operation does not change the data value, but the data value can be returned as the result. 4. Meaning The layered class may exist in several meanings of the model, including analytical layers, design layers, and implementation layers. It is important to illustrate the actual state, relationship, and behavior when expressing the concept of true world. However, the concept of information hidden, validity, visibility and methods is not related to the concept of real world (they are concepts of design). The class of the analysis layer represents the logical concept or application itself in the application domain. The analytical layer model should represent the modeling system as little as possible, and the necessary logic composition of the system is fully illustrated without the implementation and configuration. When denotes a high level design, some concepts are directly related to classes, including specific classes of state positioning, the efficiency of the object, the efficiency, the external behavior, and the internal implementation of the separation and accurate operation. The design layer represents a discrete unit that encapsulates state information and its operations in a discrete unit, which illustrates a key design decision, information positioning, and object of the object. The design layer includes two aspects of the real world and computer systems. Finally, when the program code is implemented, the form of the class is closely related to the selected language. If a universal class features cannot be implemented directly, then they have to give up them. The realization layer is directly related to the program code. The same system can accommodate multiple levels of classes, and the implementation class will achieve a more logistic class in the model. A implementation class represents a class with a specific programming language, which has got a class that follows the exact format required by the language.

However, in many cases, analysis, design, and implementation information can be nested in a separate class. 4.3 Relationships between relations related to joint, generalized, streaming, and various forms of dependencies, including relationships and use relationships (see Table 4-2). Association Relations describe a semantic connection between a separate object of a given class. The association provides a connection that can interact with different types of objects. The remaining relationships involve the description of the class, not their example. The generalization relationship allows the parent class (super class) to connect with a more specific descendant (subclass). Ultrafining is conducive to the description of the class, and each declaration requires a description from its parent class inheritance. The inheritance mechanism constructs a complete class description using the additional description of the generalization relationship. Generalization and inherit allow different types of dollar sharing properties, operations, and their common relationships without repeated instructions. Relationships will be linked to the implementation. The interface is an explanation of behavioral rather than implementation, and in the class contains the structure of implementation. One or more classes can implement an interface, and each class implements the operations in the interface. The stream relationship connects two versions of an object to a continuous manner. It represents the value of an object, state, and position conversion. The stream relationship can connect the class role in a single interaction. The species of the stream include becoming (different versions of the same object) and copy (create a new object from the existing object). Relational relationship will link behavior and implementation with classes that affect other classes. In addition to achieving relationships, there are several dependencies, including tracking relationships (a loose connection between elements in different models), refining relationship (one map between two different levels), use relationship ( The existence of another element is required in the model), binding relationship (specified for the template parameter). Using dependencies are often used to represent the relationship between specific implementations, such as code layer implementation. In summarizing the organizational unit, such as a package, the dependency is useful, which shows the system's architecture. For example, compiling constraints can be represented by dependencies. Table 4-2 Type 4.4 Association association describes discrete connections between objects or instances in the system. Association will connect a class containing two or more ordered forms to enable replication. The most common correlation is a binary relationship between a pair of categories. One of the related instances is the chain. Each chain consists of a set of objects (a sequence list), each object comes from the corresponding class. The binary chain contains a pair of objects. Associate information about the relationship between the various objects in the system. When the system is executed, the connection between the object is established and destroyed. The association relationship is "adhesive" used throughout the system, and if not it, only the isolated class that cannot work together. If the same class occurs more than once, then a separate object can be associated with yourself. If the same class occurs twice in an association, then two instances don't have to be the same object, usually in the case. Any connection point for a class is called the associated end, and many of the information related to the class is attached to its endpoint. The associated end has the characteristics such as name (role name) and visibility, and the most important feature is multi-sex and heavyweight is important for binary relationship because the definition N yuan is complicated. The binary association is represented by a connection between two classes. As shown in Figure 4-2, the connection with each other is plugged in each endpoint.

Figure 4-2 Association representation If an association is both a class and an association, it is an associated class, then this association can have its own properties (as shown in Figure 4-3). If an associated property is unique in a set of related objects, it is a qualifier (as shown in Figure 4-4). A qualifier is a value used to identify a unique object from a set of related objects in the association. The qualifier is important for modeling names and identity code, and it is also an index of the design model.

Figure 4-3 Correlation class Figure 4-4 defining a logical relationship between association in an analysis phase, associating representing an object. There is no need to specify or care about how to implement them. You should try to avoid excess associations because they do not add any logical information. In the design phase, the association is used to illustrate the separation of the design decisions of the data structure and the separation between the classes. At this time, the directionality of the association is important, and in order to improve the access efficiency of the object and the positioning of the specific class information, some necessary excess associations can also be introduced. However, in this modeling phase, the association should not be equal to the pointer in the C language. The association with navigation in the design phase represents a useful status information to a class, and they can be mapped into programming languages ​​in a variety of ways. The association can be implemented with a pointer, nested class or completely independent table object. Several other design properties include visibility and chain modificability. Figure 4-5 shows some associated design characteristics. Figure 4-5 Related Design Characteristics 1. Aggregation and Composition Aggregation Representation Partings With the overall relationship, which is represented by a line segment with an empty rhombus in an endpoint. The composition is a stronger form of association, and the whole has a unique responsibility of the management part, which is attached to the components of the constituent. Each representation of the class is a separate association between the class that represents the entire class, but for the sake of convenience, the connection is combined, and now the whole group is like a tree. Figures 4-6 show aggregated associations and composition associations.

Figure 4-6 Gathering and Composition 2. A chain chain is an example of association. The chain is related to an ordered table of the object, each object must be an instance of the corresponding class in the association or an example of such a descendent. The chain in the system is part of the system. The chain is not independent of the object, and they get their own identity from the object associated with it (in the database terms, the object list is the key). In concept, the association is significantly different from the relevant class. In practice, the association usually implements a pointer to the related class, but they can be implemented as an interlacing-containing object that is separated from the class thereof. 3. The different ends of the two-way association are easily identified, even if they are all the same. This only means that different objects of the same class can be interrelated. It is because both ends are distinguishable, so the association is asymmetrical (except for individual examples), and the two endpoints cannot be exchanged interchangeably. In general, this is a consensus: just like the subjects and objects in verb phrases. Associations are sometimes considered bidirectional, which means that logical relationships work in both directions. This view is often missed, even some methodologists. This does not mean that each class "understands" other classes, or can be accessed to each other between implementation. This only means that any logical relationship has its reverse, regardless of this reverse performance is not easy to calculate. If the association is only crossing in one direction without crossing the other direction, the association is considered to have navigation. Why use the basic model without using popular pointers in the programming language to represent the association? The reason is that the model attempts to illustrate the purpose of system implementation. If the relationship between the two classes is represented by a pair of pointers in the model, then the two pointers are still related. The association method indicates that the relationship is meaningful in both directions, regardless of how they are implemented. Conversion of associations into a pair of pointers used to implement, but it is difficult to indicate that the two pointers are reversible with each other unless this is part of the model. 4.5 Ultra-genification relationship is a general description of the class and the relationship between the specific description, and the specific description is based on the general description and expands it. Specific descriptions are fully all characteristics, members, and relationships that are generally description, and contain supplemental information. For example, mortgage is a specific type in lending, mortgage maintains the basic characteristics of borrowing, and added additional characteristics, such as a house can be used as a collateral. Generally, the description is called a parent, and the specific description is called the child, such as borrowing is a parent and the mortgage is a child. Used in class (class, interface, data type, use case, participant, signal, etc.), package, state machine, and other elements. In the class, the term hypercogence and subclass represent the father and the child. The generalization is represented from the arrow from the child to the father, pointing to the father is an empty triangle (shown in Figure 4-7). A plurality of generalization relationships can be represented by a tree consisting of arrow lines, each branch pointing to a subclass.

Figure 4-7 Uses of the generalization of generalization representation have two uses. The first use is to define the following: When a variable (such as parameter or process variable) is declared to carry a value of a given class, the instance of class (or other elements) can be used as a value, which is called Alternative principles (proposed by Barbara Liskov). This principle indicates that an example of the procealer can be used whenever ancestors are declared. For example, if a variable is declared having borrowing, then a mortgage object is a legal value. Ultrabism makes polymorphisms, that is, the implementation of the operation is the class of the object they use, not by the caller. This is because a parent class can have many subclasses, each of which implements different variants defined in the same operation in the overall concentration of the class. For example, calculating interests in mortgage and car borrowings are different, and each of them is a deformation of interest in parent class borrowings. A variable is declared having a parent class, and an object of any subclass can be used, and any of them has its own unique operation. This is especially useful because there is no need to change the existing polymorphic call, you can add new classes. For example, a new borrowing can be added in turn, while the existing code used to calculate interest operations is still available. A polymorphic operation can be declared in the parent class but no implementation, and the future category needs to add this operation. This incomplete operation is abstract (whose name is represented by a bevel). Another use of generalization is to allow it to define an increase in the increase in the premise of sharing a ancestors. This is called inheritance. Inheritance is a mechanism that is gathered from the statement of the class and its ancestors through the description of the object class. Inheriting the shared portion of the described sharing is only declared once, not repeatedly declared in each class and uses it, this sharing mechanism reduces the scale of the model. More importantly, it reduces the changes that must be done for the model update and the unexpected front and reasons are inconsistent. For other ingredients, such as status, signals, and use cases, inherit the same way. 4.5 Inheriting each of the generalization elements has a set of inheritance characteristics. For any model elements include constraints. For class, they also include some features such as attributes, operations, and signal receptions and participants in association. A subclass inherits its inheritance of all ancestors. Its complete feature includes inheritance characteristics and direct declaration characteristics. For class, there is no attribute having the same feature labeling, which will be declared multiple times, regardless of direct or inherited, otherwise conflicts, and model forms are errors. In other words, the attributes declared by the ancestors cannot be declared again by future generations. If the class interface is consistent (with the same parameters, constraints, and meanings), the operation can be declared in multiple classes. Additional statements are extra. A method can be declared in a hierarchical declaration, an alternative (overload) having the same feature labeling in any ancestor. If two or more copies of a method are inherited by a class (through different types of multiple inherits), they will conflict and model errors (some programming languages ​​allow for an explicitly selected method. We found The redefine method will be simpler and safe in the descendum. The constraint in the element is the element itself and all its ancestors constraints, if they are inconsistent, then the model form is wrong. In a specific class, each inherited or declared operation must have a defined method, whether it is directly defined or inherited from the ancestors. 4.5.2 Multiple Inheritance If a class has multiple parent classes, then it can get inheritance information from each parent class (Figure 4-8). Its feature (attribute, operation, and signal) is a combination of all of its parent class features. If the same class appears on multiple paths as the parent class, only one copy of it is in each member.

If there is a characteristic of the same characteristics, these two classes are not inherited from the same ancestor (ie independent statement), then the declaration will conflict and the model is wrong. Because experience tells us that the designers should solve this problem, UML does not provide conflict solutions for this situation. Language like Eiffel allows conflicts to be explicitly resolved by programmers, which is safe than implicit conflict resolution, and these principles often make developers' snacks. Figure 4-8 Multiple Inheritance 4.5.3 Single classification and multiple classifications In the simplest form, an object belongs to a class, and many object-oriented languages ​​have this limit. An object only belongs to a class and has no logical necessity. We can discover this as long as we observe the object of the real world from multiple angles. In the form of UML, an object can have one or more classes. Objects look like it belongs to an implicit class, and this class is a subclass of each direct parent class - multiple inheritance can be exempted from a new class, which improves efficiency. 4.5.4 Static and Dynamic Category In the simplest form, an object cannot change its class after being created. We will again explain that this restriction is not logically necessary, but the initial destination is easier to make the object-oriented programming language. In a more common form, an object can dynamically change its class, which will or lose some attributes or associations. If the object loses them, then the information in them will lose and can not be recovered afterwards, even if this object has changed back to the original class. If this object gets an attribute or association, they must initialize when changing, just like initializing a new object. When using multiple classification and dynamic classification, an object can be or lost within its lifetime. Dynamic classes are sometimes referred to as roles or types. A common modeling mode is that each object has a unique static inherent class (ie categories that cannot be changed during the life of the object), plus zero or more can be added or removed within the object life. Role class. The inherent class describes the basic characteristics of this object, and the role class describes the temporary characteristics. Although many programming languages ​​do not support multiple dynamic classifications in class declarations, it is still a very useful modeling concept and can be mapped to the association. 4.6 Implementation Relationships Connect a model element (such as class) to another model element (such as an interface), where the interface is only the description of the behavior rather than the structure or implementation. Customers must support all of the providers (by inheritance or direct declaration). Although the implementation of the relationship means having an explanation element like an interface, it can also use a specific implementation element to imply its description (not its implementation) must be supported. For example, this can be used to represent an optimized form of the class and a relationship between a simple and inefficient form. The general description can be associated with a specific description. Ultrafining will connect (eg, in the same abstraction layer) on the same semantic layer, and usually in the same model. Relationships will connect to elements within different semantic layers (eg, an analytical class and a design class; an interface with a class), and is usually built in different models. There may be two or more class levels in different development phases, which are linked through the realization relationship. The two levels do not need to have the same form, because the implementation of the class may have a dependency relationship, and this dependency is not related to the specific class. Realization is expressed in a broken line with a closed empty arrow (Figure 4-9) and is very similar to the generalized symbol. Use a special folding symbol to represent an interface (no content) and a class or component of the interface. The interface is represented by a circle that is attached to the rectangle indicating the type of element (as shown in Figure 4-10).

Figure 4-9 Implementation Relationship Figure 4-10 Interface and Implementation Icon 4.7 Dependency Depending on the semantic relationship between two or more model elements. It only connects the model element itself without having to use a set of instances to express it. It expresses such a situation that some changes in the provider will require or indicate changes in customers in the dependency. Based on this definition, associations and generalization are dependencies, but they have more special semantics, so they have their own names and detailed semantics. We usually use this term to refer to other relationships. Table 4-3 lists some dependencies in the UML basic model. Table 4-3 Dependency Type Tracking is a conceptual representation of the connection of elements in different models, usually these models are models in different stages during development. Tracking the lack of detailed semantics, it is especially used to trace the model of cross-mode system requirements and tracking models that affect the models of other models. Refinement is the relationship between two forms of two forms in different development phases or in different abstract hierarchies. This does not mean that two concepts will coexist in the final model, and one of them is usually the uninterexpreetment of another. In principle, there is a mapping between less intake to more complete concepts, but this does not mean that the conversion is automatic. Typically, more detailed concepts contain designers' design decisions, and decide can be developed through many ways. In principle, changes to one model with offset marks can be confirmed by another model. In fact, existing tools cannot complete all of these mappings, although some simple mappings can be implemented. Therefore, it is thus refined to remind the moderator multi-model to interrelated in a presence manner. The export representation represents an element to obtain another element (and the exported elements can be explicitly included in the system to avoid too much cost for iteration). Export, implementation, refinement, and tracking is abstract dependence - they link different forms of potential things. Using a behavior or implementation of an element can affect the behavior or implementation of another element. Typically, this comes from some issues related to implementation, such as the compiler requirement to define another class before compiling a class. Most of the use dependencies can be obtained from the code, and they don't need to be clearly declared unless they are part of the self-designed style system (eg, using a predefined component or "library). Special use of the relationship can be described in detail, but because the purpose of the relationship is to protrude, it is often ignored. The exact details are available from the implementation code. The constructor used includes calls and instances. Call indicates a method in a class to call another class; an instance represents an instance of another class. Several use dependencies allow certain elements to access other elements. Access reliance allows a package to see the content of another package. Introducing dependence can reach a higher requirement, you can add the name of the target package content to the namespace of the introduction package. Friends reliance is an access dependence that allows customers to see the provider's private content. The binding is the parameter assigned to the template. It is a highly structured relationship with exact semantics, which can be implemented by replacing parameters in template backups. Using and binding relying on a strong semantic in the same semantic layer into an element. They must connect the elements of the same layer (or the analysis layer, or the design layer, and at the same abstraction). Tracking and refining reliance more blurred, can connect elements of different models or different abstraction layers. Relationship (a elementary relationship, not limited to dependencies) examples represent an element (such as an object) is an example of another element (such as class). Depending on the virtual arrow from the customer points to the provider, use a structured key to distinguish its kind, as shown in Figure 4-11.

Figure 4-11 Depending on 4.8 Constraint UML provides a set of concepts and relationships to modeling systems in the form of model element charts, and some of them will be better, namely the advantages of text language. The constraint is a Boolean expression that can be represented by a string explained by a particular language. Natural language, symbols in the collection theory, constraint languages, or various programming languages ​​can be used to represent constraints. A constraint language, OCL is defined in UML, which facilitates expression of UML constraints and has a wide range of support. See "OCL Getting Started" and [Warmer-99] and other books. The constraint can be used to represent various non-local relationships, such as limits on the associated path. The constraint can be used, in particular, to express the presence characteristics (existing X, the C conditions) and the general characteristics (for all Y, the conditions D must be established). Some standard constraints have been pre-defined in advance as standard elements, including all kinds of constraints in the relationship between the different or relationships, and the generalized neutrical relationships. See Chapter 14 for details. Constraints are represented by text expressions within a large brackets, which can be used in a form language or natural language. The text string can be written as an annotated or attached to the arrow of dependencies. Figure 4-12 shows some constraints. Figure 4-12 Constraint Relationship 4.9 An instance of an instance is a run entity with identity, ie it can be distinguished from other run entities. It has a value at any time, and the active value will be changed. One of the uses of the model is to describe a possible state of a system and their behavior. The model is a description of potential, and a description of the possible behavioral history of possible object sets and object experiences. Static view defines and limits the possible configuration of running system values. A dynamic view defines a way that the running system is passed from a configuration to another. In short, static views and the various dynamic views established on it define the structure and behavior of the system. A system-specific static configuration is called a snapshot at a certain time. Snapshots include objects and other instances, values, and chains. Object is an instance of a class, which is a direct instance of its class and an indirect instance of the ancestor of that class (if allowable, the reordering object may be a direct instance of multiple classes). Similarly, the chain is associated with an instance of the value is an instance of the data type. Objects There is a data value for each attribute of its class, each with the value of the data type of the attribute. If the attribute has optional or multiple multiplex, the property can have zero or more values. The chain contains multiple values, each value is a reference to the object of a given class or a given class. Objects and chains must comply with their classes or associated constraints (where both explicit constraints and constraints such as multi-weight). If each instance of the system is an example of some elements of a well-known system model, and instance meets all the constraints of the model, the status of the system is an active system instance. A static view defines a set of objects, values, and chains that are available in separate snaps. In principle, any combination of objects and chains consistent with static figures is a possible configuration. But this doesn't mean that each possible snapshot can appear. Some snapshots may not be dynamically achieved in static, but may not be dynamically achieved in the dynamic diagram of the system. UML behavior section describes the effective sequence of snapshots, and snapshots may appear as the result of the influence of the partial and internal and external behavior. Dynamic diagrams define how the system is converted from a snapshot to another. A picture of the 4.10 object map snapshot is an image of the system at a certain moment. Because it contains images of an object, it is also called an object map. As a sample of the system it is useful, such as a complex data structure or a series of snapshots (as shown in Figure 4-13). Remember that all snapshots are samples of the system, not the definition of the system. System structure and behavior define in the definition view, and establish a defined view is the target of modeling and design. The static view describes the possible examples. In addition to the sample, the actual instance does not always appear directly in the model.

Figure 4-13 Object map

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

New Post(0)