Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Why is UML important?

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces why UML is very important, has 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.

UML practice-UML activity diagrams, sequence diagrams, state diagrams, collaboration diagrams

The key to dealing with object-oriented problems is modeling. Modeling can abstract many important details in a complex world. Many modeling tools encapsulate UML (that is, Unified Modeling Language ™), and the purpose of this course is to demonstrate the highlights of UML.

There are nine modeling icons in UML, namely:

Use case diagram

Class diagram

Object graph

Sequence diagram

Collaboration diagram

State diagram

Activity diagram

Component diagram

Configuration diagram

Some parts of this course contain page links to the details of these diagrams. And each part has a small problem, test your understanding of this part.

Why is UML important?

To answer this question, let's look at the construction industry. The designer designed the house. The builders used this design to build the house. The more complex the building, the more important the communication between designers and builders. Blueprints have become a required course for designers and builders in this industry. Writing software is like building a building. The more complex the system, the more important the communication between the people involved in writing and configuring the software. Over the past decade, UML has been the "architectural blueprint" between analysts, designers and programmers. Now it has become part of the software industry. UML provides a common language for analysts, designers and programmers in software design.

UML is applied to solve object-oriented problems. If you want to learn UML, you must be familiar with the fundamental principles of object-oriented problem solving-- all starting with the construction of models. A model model is the abstraction of the fundamental problem. The domain domain is the real world in which the problem lies.

The model is composed of object objects, which interacts with each other by sending messages messages to each other. Remember to think of an object as "alive". Objects have what they know (property attributes) and what they can do (behavior or action behaviors or operations). The value of the object's property determines its state state.

The class Classes is the "blueprint" of the object. A class encapsulates attributes (data) and behaviors (methods or functions) in a separate entity. The object is an instance of the class instances.

Activity diagram

The activity diagram in UML practice activitydiagram is a very special flow chart. There is a relationship between the activity diagram and the state diagram. The state diagram focuses on the objects in the process, while the activity diagram focuses on a separate process action flow. The activity diagram tells us about the dependencies between activities.

For our example, we use the following process.

"withdraw money through ATM."

This activity has three classes Customer,ATM and Bank. The whole process starts with a black circle and ends with a black-and-white concentric circle. The activity is represented by a rounded rectangle.

Activity diagrams can be decomposed into many objects swimming lane swimlanes, which can determine which objects are responsible for which activities. Each activity has a separate transfer transition to connect to these other activities.

Transfer may branch branch into more than two mutually exclusive transfers. The guard expression (in []) indicates that the transfer is derived from a branch. The branch and the merged merge at the end of the branch are represented by a diamond in the figure.

The transfer can also break down the fork into more than two parallel activities. The thread at the end of the decomposition and the end of the decomposition, combined with join, are represented by bold lines in the diagram.

Sequence diagram

In UML practice, class diagrams and object diagrams are views of static models. The interaction diagram is dynamic. They describe the interaction between objects.

The sequence diagram represents the interaction as a two-dimensional diagram. Longitudinally is the timeline, and time extends downward along the vertical line. The horizontal axis represents the meta-roles of individual objects in collaboration. Meta-roles are represented by lifelines. When the object exists, the character is represented by a dotted line, and when the process of the object is active, the lifeline is a double line.

Messages are represented by arrows from one object's lifeline to another. The arrows are arranged from top to bottom in the diagram in chronological order.

Collaboration diagram

Collaboration diagrams are also interactive diagrams in UML practice. They convey the same information as sequence diagrams, but they don't care about when the message is delivered, only about the role of the object. In the sequence diagram, the role of the object is placed on it and the message is the connection line.

The object role rectangle is marked with a class or object name (or both). The class name is preceded by a colon (:).

Each message in the collaboration diagram has a serial number. The number of the top-level message is 1. Messages of the same level (that is, messages in the same call) have the same numeric prefix, and then add a suffix 1Magne2 and so on according to the order in which they appear.

State diagram

In UML practice, objects have behaviors and states. The state of an object is determined by its current actions and conditions. The state diagram statechartdiagram shows the possible state of the object and the transition caused by the state change.

Our model diagram establishes an online login system for banks. The login process includes entering a valid password and personal account number, and then submitting the information to the system for verification.

The login system can be divided into four non-overlapping states: GettingSSN,GettingPIN,Validating, and Rejecting. Each state has a complete set of transition transitions to determine the order of states.

The state is represented by a rounded rectangle. The transfer is represented by a connection with an arrow. The event or condition that triggers the transfer is written next to the arrow. We have two self-shifts on our chart. One is on GettingSSN and the other is on GettingPIN.

The initial state (black circle) is the virtual beginning of the start action. The end state is also the virtual end of the action.

It is indicated by (/ action) when an event or condition triggers an action. When entering the Validating state, the object does not wait for an external event to trigger the transition. Instead, it produces an action. The result of the action determines the state of the next step.

Thank you for reading this article carefully. I hope the article "Why UML is important" shared by the editor will be helpful to everyone. At the same time, I hope 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: 0

*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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report