Sequence diagram definition  : Describes the relationship between objects The time order in which messages are delivered , Used to represent... In a use case The order of behavior , It's about emphasizing Message chronology Interaction graph of ;

The things that a sequence diagram describes : The sequence diagram describes in the system The interaction between classes , Model these interactions as The message exchange , The sequence diagram describes Classes and exchanges between classes With The message of the expected behavior completed , Each message in the sequence diagram represents An operation of class   perhaps The trigger event that causes the state machine to change ;

The sequence diagram shows  : The objects involved in the interaction are in the sequence diagram The top is horizontal , At the bottom of each object is drawn a The vertical dotted line , object A Image object B Send a message , Use one A solid line with an arrow Express , The solid line starts from the object A The dotted line at the bottom , Terminate in object B The dotted line at the bottom ; The solid arrows are placed horizontally ,  The closer to the top, the sooner it's sent .

Sequence diagram trajectory  : The sequence diagram provides Over time Clear   visualization Track of ;

1 The sequence diagram consists of

The sequence diagram consists of  : The sequence diagram consists of four elements   object (Object) Lifeline (Lifeline) Activate (Activation) news (Message);

1.1 object (Object)

object  : The object in the sequence diagram plays the role of object in the interaction ;

Symbols of objects  : Objects in the sequence diagram are represented in the same way as objects in the diagram , Use rectangles to include object names , And the object name is underlined ;

Object creation time  : Objects can be created at the beginning of an interaction , It can also be created during interaction ;

--  At the top  : If the position of the object is at the top of the sequence diagram , Indicates that the object already exists at the beginning of the interaction ;

--  Not at the top  :  If the position of the object is not at the top , So the object is created in the process of interaction ;

1.2 Lifeline (Lifeline)

Lifeline  : The lifeline is a vertical dotted line , This dotted line Represents the existence of an object , In the sequence diagram , There is a lifeline at the bottom of each object ;

Lifeline function  : The lifeline is a timeline , From the sequence diagram Top to bottom All exist , Its length Depending on the time of interaction ;

The lifeline of the object  : The combination of the object and the lifeline is the lifeline of the object , The concept Contains object icons as well as The lifeline icon below the object   Pictured above ;

1.3 Activate (Activation)

Activate (Activation) : Represents the object in the sequence diagram The period during which an operation is performed , Activation period can be understood as in semantics {} The content in , It means that we should Object is occupied to complete a task ;

Deactivation (Deactivation) : Refers to the object At rest , Waiting for a message to activate this object ;

The active representation  : When the object is active , Lifelines can be widened into rectangles , This rectangular bar becomes the active bar ;

The time to activate and to de activate  :

--  Activate  : Object activation is at the top of the activation bar ;

--  Deactivation  : Activate the bottom of the bar to activate , It usually happens when a message leaves the object lifeline ;

1.4 news (Message)

Message concept  : Definition   Interaction   and   Collaboration   in   Exchange information   Class , Yes Between objects   Communication content modeling ;

Message action  :

--  Action type  : The message allows Passing information between entities ( Pass parameters ), allow The entity requests other services , Between objects send out and receive news communicate ;

--  Produce results  :  News can Trigger operation Evoke signals , Or make the goal objects creating or The destruction ;

Asynchronous and synchronous communication of messages  :

--  asynchronous communication  :  Messages are signals When , After sending the signal , Wait for the other party to trigger the corresponding method , This is clear Named Asynchronous communication between objects ;

--  Synchronous communication  : direct Method of calling object , Execute the method and return the result , This kind of operation with return control mechanism is synchronous communication ;

The difference between messages in a sequence diagram and a collaboration diagram  : The message in the sequence diagram emphasizes The order , The messages in the collaboration diagram emphasize the importance of exchanging messages The relationship between objects ;

Message type  :

--  : Draw messages between two objects ;

--  : Procedure calls between two objects ;

--  : Asynchronous messages between two objects ;

--  : The message returned in the procedure call ;

--  : Draw reflexive messages ;

2. Example of sequence diagram

Sample introduction  :

--  Use scenarios  : Car rental company ;

--  Objects used  : Customer ( Customer ), Worker ( Personnel ), Order ( request ), Record ( Record ), Car ( automobile );

--  Workflow  : ① Customer towards Worker Ask for a taxi , ② Worker Check request , ③ Customer payment , ④ Worker Fill in Record , ⑤ Worker Pick up the car ;

Sequence diagram  :

3. Object creation and revocation

object anchors  :

--  Top  : The default position of an object in a sequence diagram is at the top of the sequence diagram , This indicates that the object already exists between the beginning of the interaction ;

--  middle  : If the object is in the middle of the sequence diagram , Created during interaction when describing objects ;

How to create objects during interaction  :

--  The message points to the object  : The message is the construction method , The arrow points to the rectangle represented by the object ;

--  The message points to the activation bar  : The message is the construction method , The arrow points to the activation bar below the object ;

Undo object  : If you want to undo an object in the sequence diagram , Because if there are several objects at the same time , Without special operations, the life cycle will be the same ;

--  design sketch  : In the picture below Customer and Order Object undone , Because they basically don't participate in the later interaction ;

4. Sequence diagram modeling technology

Timing of sequence diagram use  : Modeling dynamic behavior , When it comes to emphasizing the order in which time unfolds information , Use sequence diagrams ;

Sequence diagram management strategy  :

--  Single control flow  : A single sequence diagram can only show one control flow ;

--  Multiple sequence diagrams  : The complete flow of control is complex , You can draw multiple sequence diagrams , A trunk sequence diagram , Multiple branch sequence diagrams , Use packages to manage these sequence diagrams ;

Time series diagram modeling strategy  :

--  Set the interaction context  : The environment of the interaction , Which objects are included , What kind of system does it belong to , Subsystem , Related operations class Use cases, etc ;

--  The order of objects  : According to the importance of the object , From left to right in the sequence diagram ;

--  Object lifeline  : Objects usually exist throughout the interaction , It can also be created and undone during interaction ;

--  Message permutation  : After triggering the interactive information , Messages are drawn in chronological order from top to bottom , The first message stay After the message sent above ;

--  Activation period settings  : You can take the actual operation of Point in time news Show it clearly ;

--  Time and space constraints  : Each message can be attached with the right time and Space constraints ;

--  Pre and post conditions  : Each message can be attached with In front of or After Conditions ;

UML More articles on sequence diagrams

  1. [ Reprint ]UML The sequence diagram summarizes

    Preface In my work , The most used is the sequence diagram . Maybe because of work , I also like drawing time sequence diagram best , Very clear , It's clear. , When to send what message , To what state , It's in your head all at once , For message driven programs , It can't be better ...

  2. 10 Learn to use in minutes Markdown draw UML Sequence diagram

    1.1 What is? Markdown? Markdown It's a kind of grammar that's very rare . Very simple markup language , Used to document . use Markdown The document is written in plain text format , Rendered by the editor , It's a platoon A beautiful version of the document , This article is to use M ...

  3. Use Astah Make UML Sequence diagram

    Astah Make UML chart -- Detailed explanation The production of sequence diagram Introductory words : This article is the original article of glory road , Welcome to reprint , But please note the source . It's hard to avoid seeing the developers draw all kinds of design drawings , They are envious , such as : Handsome , Beautiful , In fact, we testers can also easily ...

  4. UML series 04 And UML Sequence diagram

    Summary This chapter is right UML In this paper, we introduce the time sequence diagram of , The main contents include : Sequence diagram introduces the composition of sequence diagram Reprint please indicate the source : Introduction to sequence diagram ...

  5. UML series 03 And UML Sequence diagram

    Introduction to sequence diagram Sequence diagram (Sequence Diagram), Also called sequence diagram or sequential diagram , It's a kind of UML Behavior graph . The time sequence diagram is used to describe how the internal system interacts , It shows the dynamic cooperation among multiple objects by describing the time sequence of messages sent between objects ...

  6. Python Design patterns - UML - Sequence diagram (Sequence Diagram)

    brief introduction A sequence diagram represents the relationship between participants and objects . The dynamic interaction process and time order relationship between objects . The sequence diagram shows the state of the object changing with time in detail and intuitively . Call relations and message timing , The main elements in a sequence diagram are : participants (Actor), object (Obj ...

  7. uml The first impression of sequence diagram -------Day64

    Recently, there are many ideas that can't wait to be realized , But in fact, it was very clear at the beginning , There are always failures where there is no problem , Leading to a little bit of impatience , Calm down . It's the weekend again . I'm going to pack up and move tomorrow and the day after tomorrow , I don't know if broadband can be moved smoothly ...

  8. UML Sequence diagram (Sequence Diagram) Learning notes

    What is a sequence diagram? Sequence diagram (Sequence Diagram), Also known as sequence diagram . Sequence diagram , It's a kind of UML Interaction diagram . It shows the dynamic collaboration among multiple objects by describing the time sequence of sending messages among objects . Let's have a look visio2016 For timing ...

  9. UML The sequence diagram summarizes

    Preface In my work , The most used is the sequence diagram . Maybe because of work , I also like drawing time sequence diagram best , Very clear , It's clear. , When to send what message , To what state , It's in your head all at once , For message driven programs , It can't be better ...

Random recommendation

  1. About rem The custom of HTML Scale setting

    By setting html Root label font-size value , control rem To achieve the global layout of the adaptive ,CSS All units of length go through rem Set up Must be in head You can't delay the introduction of : (function (doc, win) { ...

  2. All places IT Salary discussion

    As a business .net Development programmer , Three and a half years in Beijing , I'm going to quit my job and look for a job in Shanghai recently . Due to the IT The industry doesn't know much about , Here, I would like to let my colleagues in Shanghai talk about your situation , To facilitate my positioning in Shanghai , Of course , Colleagues from other cities ...

  3. canvas & animation

    1.using canvas using canvas to set difference property. it will showing like an animation. The true ...

  4. NSStringDrawingOptions-b

    If options Parameter is NSStringDrawingUsesLineFragmentOrigin, Then the size of the whole text will be calculated in the rectangle of each line .( It's a little strange here , Because the font height is about 13.8 ...

  5. 【LA 5713 】 Qin Shi Huang's National Road System (MST)

    [ The question ] Qin Shihuang will be in n Building roads between two cities , And Xu Fusheng can use magic to repair the first emperor of Qin for free 1 Strip road , Each city has its own population , Now, the sum of the population of the two cities where Xu Fusheng built the road A As big as possible , And make n There is a long road to be built between two cities B Try to be as short as possible , Thus making A/B ...

  6. Opencl API explain ( Two )

    Welcome to your attention , Please indicate if you want to reprint Here's a little bit more about OpenCL API The function of 1. establish buff ...

  7. oracle12 pl/sql

    pl/sql Block Introduction Introduce   block (block) yes pl/sql The basic program unit of , To write pl/sql The program is actually writing pl/sql block , To complete relatively simple application functions , Maybe you just need to write one pl/sql block , But if you want to be real ...

  8. poj 1204 Word Puzzles( Dictionary tree )

    Topic link : Thought analysis : Due to the weak topic data , Use violent search : Build a dictionary tree for all the searched words , Every coordinate in the graph , Go to 8 Search in all directions : We need to pay attention to ...

  9. Take the series of soft test questions ip Automatic agent

    immediately 5 There is a software professional grade examination in June , Soft test for short , In order to better review for the exam , I'm going to grab Online soft test questions . That's the background . I haven't updated the blog of blog park for a long time , So the previous code was not posted in time , We ...

  10. CodeForces621E Fast matrix power optimization dp

    Sometimes we use fast matrix power optimization dp When , Its matrix multiplication is not so easy to be specified as the meaning of the topic background , Most of the time, it is difficult to understand the practical significance of multiplication between matrices , Just as sometimes we don't know the meaning of doing these things now , But if it's a goal ...