Chapter 4 Expansion Mechanism 11.1 Overview UML provides several extension mechanisms that allow modelers to make some general extensions without changing the basic modeling language. These scaling mechanisms have been designed so that they can be stored and used without understanding all semantics. For this reason, extensions can be stored and used as strings. For a tool that does not support the extension mechanism, expansion is just a string. It can be imported, stored, and passed to other tools as part of the model. We expect backend tools to be designed to handle various extensions that define specific syntax and semantics for the extensions they need to understand. This extension method may not meet a variety of requirements, but it can accommodate most of the requirements of the modeler on UML in an easy-to-implement and simple way. The scaling mechanism includes constraints, tag values, and constructors. Be sure to remember that extensions violate the standard form of UML and that using them will affect each other. Before using the extension mechanism, the modeler should carefully weigh its benefits and costs, especially when the existing mechanism can work properly. Typically, extensions are used in specific application domains or programming environments, but they lead to the emergence of UML dialects, including the advantages and disadvantages of all dialects. 11.2 Constraints Constraints are Semantic Restrictions expressed using text expressions. Each expression has an implicit interpretation language, which can be formal mathematical symbols, such as set-theoretic notation, or a computer-based constraint language, such as OCL. Programming Language , Such as C ++; or pseudo Code Or informal natural language. Of course, if the language is informal, its interpretation is informal, and it should be explained by people. Even if a constraint is expressed in a formal language, it does not mean that it is automatically a valid constraint. Constraints can indicate constraints and relationships that cannot be expressed in UML notation. Constraints are particularly useful when you state global conditions or conditions that affect many elements. The constraint is represented by a string expression in a Large arc. Constraints can be attached to table elements, dependencies, or annotations. Figure 11-1 shows several constraints.
Figure 11-1 Constraints 11.3 tag Value A tag value is a string-a tag string and a value string-that stores information about elements. Tag values can be related to any independent element, including model elements and expression elements. A tag is the name of a feature that the modeler wants to record, and a value is the value of a feature of a given element. For example, the flag can be author, and the value is the name of the person in charge of the element, such as Charles Babbage. Tag values can be used to store any information about an element. They are especially useful for storing project management information, such as the creation date, development status, end date, and test status of an element. In addition to the internal metadata model attribute name, any string can be used as the Tag Name (because tags and attributes are considered to be an element attribute together and can be accessed together by tools ), some tag names have been predefined. See Chapter 2 ). The tag value also provides a way to associate additional information independent of the implementation with the element. For example, the Code Generator needs additional information about the code type to generate code from the model. Generally, there are several ways to correctly implement the model. The Modeler must provide guidance on the selection. Some markup can be used as a flag to tell the code generator which implementation method is used. Other tags can be used as joining tools, such as the Project Plan builder and report writer. Tag values can also be used to store information about the constructor elements (as discussed below ). The tag value is represented by a string. The string contains the tag name, equal sign, and value. They are placed in a Large arc (11-2) by rule ). The value marked in the chart is often omitted and displayed only in the drop-down table.
Figure 11-2 tag Value 11.4 Constructor Many modelers want to define a modeling language for a specific application domain, which brings some risks because the language to be tailored is not universally understood, but people are still trying to do so. Constructor is a new model element constructed based on a defined model element. The information content and format of the constructor are the same as those of the existing basic model elements, but their meanings and usage are different. For example, modelers in the business modeling field want to distinguish Business Objects from business processes as special modeling elements. These elements are used differently in specific development processes. They can be seen as special classes-they have attributes and operations, but they have special constraints on their relationship with other elements and their use. The constructor is based on an existing model element. The information of the constructor element is the same as that of the existing model element. This allows the tool to store and use new and existing elements in the same way. Constructor elements can have their own distinctive symbols, which are easily supported by tools. For example, a "business organization" can have an icon that looks like a group of people. A constructor can also have a set of constraints that apply to its use. For example, a "business organization" may only be associated with another "business organization" and cannot be associated with any other category. Not all constraints can be automatically determined by multi-purpose tools, but they can be determined by manual execution or constructor joining tools. Constructor can use tag values to store additional features not supported by basic model elements. The constructor is represented by a text string in double angle brackets. It can be placed inside or beside the symbol that represents the basic model element. You can also create a symbol for a special constructor. This symbol replaces the symbol of the original basic model element.
Figure 11-3 Constructor 11.5 tailoring UML The constraint extension mechanism, tag value, and constructor make it possible to customize the UML Profile for special application domains. Several outlines have been formed. For details, see appendix C. In addition, the user also raised other questions. This ability to tailor the modeling language means that users in the application domain can adapt the modeling language to the needs of the application domain and share the concepts that are commonly used in all fields. |