In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces what are the constituent elements of UML, which have a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand.
1. The building blocks composed of UML
1. The building block is the abstraction of the representative components in the model.
Modeling element: a noun in UML, which is the basic physical element of the model.
Behavior element: a verb in UML, which is a dynamic part of the model and a behavior that spans time and space.
Grouping elements: containers in UML that are used to organize models and make them more structured.
Comment element: the interpretation part of UML, like the comment statements in the code, is used to describe the model.
1.1. Modeling elements
Classes (class) and objects (object)
Interface (interface)
Active class (active class)
Use case (use case)
Collaboration (collaboration)
Component (component)
Node (node)
Classes (class) and objects (object)
A class is an abstraction of a set of objects with the same attributes, operations, relationships, and semantics.
The class in the UML composition is represented by a rectangle, which contains three areas, with the name of the class at the top, the properties of the class in the middle, and the method of the class at the bottom.
The object is an instance of the class (object is an Instance of Class)
Interface (interface)
An interface is a set of service operations that describe a class or component
Active class (active class)
The active class is actually a special class. The reason for referencing it is actually that some classes are needed to initiate control activities in development.
An active class is a class whose object has at least one process or thread and can start a control activity.
Use case (use case)
The use case in the composition of UML was first put forward by the famous master Ivar Jacobson, and now it has become the most commonly used tool for requirement analysis in object-oriented software development.
A use case example is a series of actions performed in the system that will produce value results visible to a particular executor. A use case defines a set of use case instances.
Collaboration (collaboration)
Collaboration defines an interaction, which is a group of roles and other elements that work together to provide a collaborative behavior.
The implementation of a use case can be expressed as a collaboration
Component (component)
UML composition in the actual software system, there are many larger than the "class" entities, such as a COM component, a DLL file, a JavaBeans, an execution file, and so on. In order to better represent them in the UML model, components are introduced.
Component is a modular part of system design, which hides the internal implementation and provides a set of external interfaces. Components that meet the same interface in the system can be replaced freely
Node (node)
In order to model the structure of deployment effectively, UML introduces the concept of node, which can be used to describe the basic hardware on which the actual PC, printer, server and other software runs.
A node is a physical element that exists at run time and represents a computable resource that usually has at least storage space and processing power.
1.2. Behavioral elements
Interaction: a collection of information exchanged between a group of objects that accomplish a task together in a particular context
The representation of interaction is simple, which is a directed line with the operation name on it.
State machine (state machine): the sequence of states experienced by an object or interaction in response to events during the life cycle
Draw the state as a rounded rectangle in the UML model, and write the name of the state and its sub-states in the rectangle.
1.3, grouping elements
For a medium and large software system, it usually contains a large number of classes, so there will be a large number of structural things and behavioral things. In order to integrate them more effectively, it is necessary to group them into simple or complex, macro or micro models. In UML, "Package" is provided to accomplish this goal.
1.4. Comment elements
Structural things are the main building blocks of the model, behavioral things supplement the dynamic part of the model, grouping things but used to better organize the model, seems to be very complete. On the other hand, annotated things are used as the icing on the cake, it is used to add appropriate interpretation parts to the UML model.
2. Relationship
2.1 Association relationship
The Association in the composition of UML indicates that there is some semantic connection between two classes. The association relationship provides the path of communication, which is the most common and the weakest semantic of all relationships.
In UML, a solid line is used to represent the association relationship
In the association relationship, there are two special relationships: aggregation and combination.
Aggregation relationship: aggregation (aggregation) is a special form of association. Aggregation indicates that the relationship between classes is the relationship between the whole and the part.
If it is found that the existence of the "partial" class is completely dependent on the "whole" class, then the "combination" relationship should be used to describe it.
Composition is a variant of aggregation, adding some important semantics. In other words, in a combinatorial relationship, an object is only part of a combination at a time, and the whole is responsible for the creation and destruction of the part. When the whole is destroyed, the part disappears.
Aggregation is like cars and tires, which can be used when the tires are broken. A combination is like a company and its subordinate departments. When a company goes bankrupt, the department no longer exists!
2.2 generalization, implementation and dependency
The generalization relation describes the relationship between the general thing and the special kind in the thing, that is, the relationship between the parent class and the subclass.
The implementation relationship is used to specify the relationship between the interface and the class or component that implements the interface. An interface is a collection of operations that specify the services of a class or component.
There are two elements X and Y, and if changing the definition of element X may cause a change to the definition of another element Y, element Y is said to be Dependency on element X. Let's take a look at the second UML component, the rules.
II. UML composition rules
Naming: that is, naming things, relationships, and diagrams. Like any language, a name is an identifier
Scope: similar to the scope of a class.
Visibility: Public,Protected,Private,Package
III. UML common mechanism in the composition of UML
1. Specification description
Each part of the graphical representation is followed by a specification (also known as a detailed description) that is used to literally describe the syntax and semantics of the building blocks. This idea separates visual views from text views:
2. UML modification and general division.
In order to better represent these details, UML also provides some decorative symbols, such as symbols with different visibility, and abstract classes represented in italics.
General division of UML:
1) the division of classes and objects: a class is an abstraction and an object is a concrete instance.
2) the separation of interface and implementation: the interface is a declaration, a contract and the entrance to the service, while the implementation is responsible for implementing the contract provided by the interface.
3. UML extension mechanism
This part is not easy to describe and needs to be changed. (note 2009.2.18)
Stereotype: in the actual modeling process, it may be necessary to define some building blocks specific to a certain domain or system, and the tag values are used to add new features to things. The tag value is represented by a string in the form of "{tag information}"
Constraints are mechanisms used to add new semantics or change existing rules (free text and OCL representations). The representation of a constraint is similar to the tag value method, using a string enclosed in curly braces, but it cannot be placed in an element, but near the related element.
4. UML views and diagrams
Thank you for reading this article carefully. I hope the article "what are the constituent elements of UML" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 294
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.