6. Use the [iconix] method to design a blog [sequence diagram]

Source: Internet
Author: User
Tags key case
6. Use the [iconix] method to design a blog [sequence diagram]

In the previous articles, we performed domain model and case modeling respectively, and used the robustness tool for further analysis and verification.
Based on the corresponding model (domain model), the related boundary pair is introduced through the robustness method.
Control Object (Controller), and update the attributes (fields) of classes in the corresponding domain model ). Next, you can enter the interactive modeling stage.
. For example:

As an interactive modeling, you need to find the interaction between objects and then allocate methods (operations or actions.

The so-called"Only after all the use cases establish an interactive mode for all the event processes can the system be determined
The roles and responsibilities of each object.
"------ Ivar Jacob

In other words, after drawing the sequence diagram for all the basic flows and all the branch flows of each use case,
In order to ensure that all responsibilities of each object are discovered.

I think there is no other word to describe Ivar jacson, the original master of UML. He
It is the inventor of the robustness diagram, sequence diagram, and the famous "Use Case". The following is a comment from csdn on him:
Over the past 40 years, Ivar Jacob son has always been passionate about the entire software industry with its creative passion and amazing talent.
The industry maintains an extraordinary influence and is one of only a handful of world-class software masters. He works with Grady booch and James rum-
The three members of Baugh created UML with far-reaching significance. Therefore, they were collectively called "three friends of UML ". Object-Oriented Software Engineer
Cheng and user guide for UML language have become a typical software book.

The following link is his latest video on csdn:
Http://live.csdn.net/Issue252/LivePlay.aspx)


In UML, interactive modeling includes two forms: Sequence Diagram (sequence diagram, sequence digram) and Co --
Llaboration digoal ).

The time sequence diagram of UML evolved from the object interaction diagram of Ivar Jacob's son and the event tracking diagram in OMT. It is used
Describes the dynamic interaction between objects, focusing on the time sequence of message transmission between objects. It allows intuitive representation of the generation of Objects
Period. During the lifetime of an object, the object can respond to the input message and send the message. In other words, it can make
The family can easily find out the sequence of events. For each use case, you will draw a sequence diagram that contains
Basic Process and all analysis processes. As the core of the dynamic model, the sequence chart's behavior in the running stage (including how the system implements
These behaviors are defined in detail.

A sequence chart contains four elements:

Describes the operation processUse Case text: On the left side of the sequence chart, use blank spaces to separate the text, so that you can easily know which sentence
The element on the right.

Object: It is represented by a box containing two names, which is directly moved from the robustness diagram. These two names are respectively class names
And the object name (instance number) in the format of Class: object. Any of these names can be omitted. You can also use a robustness diagram.
The construction type is used to display objects, which helps track participants, boundary objects, and messages transmitted between implementation objects.

Message: Arrow between objects. The message arrow can be located between two dotted lines, a straight line and a method rectangle, or between two methods rectangles.

Method (Operation): It is represented by a rectangle located on the dotted line. The dotted line belongs to the object of this method. The length of the rectangle can be used.
Degrees to reflect the time with control focus. The control focus is theoretically useful, but not actually because most Visualization
Modeling tools are not very powerful in this regard. If it is difficult to display the control focus on the sequence chart, you only need to disable this function.

The other is a collaboration diagram that emphasizes the Organization. It is used to describe the interaction and link relationships between the objects that interact with each other. It corresponds to the time
The sequence chart is different: the sequence chart focuses on the time sequence of interaction, and the Collaboration chart itself focuses on the interaction
Static link between images. It specifies how objects are statically connected and work collaboratively.

Because iconix emphasizes the use of time sequence graphs as the main tool for interactive modeling, the following interactive modeling is mainly about
Expanded around the time sequence diagram :)

In addition, it should be emphasized that three main objectives should be achieved during interactive Modeling:
1. Allocate behavior between the boundary object, object, and control object. If you do not know the related boundary object
It is too early to consider how to allocate the behavior of the object and the control object, and the robustness analysis should be returned.
OK.
2. List detailed interactions between objects involved in the use case over time. In the running stage, objects are sent through each other
Send messages for interaction. For each behavior unit in the use case, the required message/method must be determined.
3. Finally, determine the method (operation) allocation between classes.

In the iconix method, it takes four steps to draw the sequence chart:
Step 1: copy the use case text in the use case specification and paste it to the left of the page.
Step 2: add the object in the robustness graph. All these objects represent instances of classes in the class diagram of the static model. In the painting
When generating a sequence chart, if you find any missing attribute, you must add it to the static Query type. This is the most
Next step.
Step 3: add the boundary object and participant of the robustness graph. Add the boundary objects to the domain model because these objects belong
Solution space, while the domain model targets the problem space. When you consider a boundary object in a sequence chart
The two types of space are integrated.
Step 4: Determine which methods are assigned to which classes. Assign the method to the class. You need to convert the controller in the robustness diagram.
(One at a time) is a group of methods and messages for executing the required behavior (20% of controllers are finally converted to a real
). In this process, the robustness diagram is used as a checklist to ensure that the sequence diagram considers
All system behaviors. In addition, a controller in a robustness diagram can be converted to multiple methods in a sequence diagram.

Now, with the introduction and preparation of these basic concepts and knowledge, let's start the text of today :)

The Sequence Chart of the use case to be drawn is:"Login System"

Paste the following example text to the left of the sequence diagram.

User name: Login System
Basic Process:
You can click the logon link on the homepage. The background logon page is displayed. The user enters his/her name in the login form,
Password and click Submit. After the system confirms that the information submitted by the user is valid, the initial user information is required. And return the first
Page.
Branch process:
If the user does not provide a name, the system displays an error message notifying the user to enter the name.
If the password provided by the user is incorrect, the system displays an error message asking the user to enter the correct password.

Then introduce the corresponding object (from the robustness diagram), assuming the robustness diagram is as follows:


The entity objects are "user information list" and "user information", which are introduced into the sequence diagram.

The next step is the border object and the participants. (It should be noted here, because it is usually accessed through a boundary object (class ).
Ask the system, so the start direction of the message is usually the boundary class, so place the boundary class and the participant on the left .)

After this "tossing", we see the following layout: (prepare sequence)

Next, we will introduce the corresponding method into the class. The principle is that "convert the controller in the robustness diagram (one at a time)
It is a set of methods and messages for executing the desired behavior (20% of controllers are finally converted into a real control object )".

I believe that many people have made time sequence diagrams before, so they put the final allocation result (if you think there is
Errors or awkwardness can be discussed in the reply. The same is true for other sequence diagrams below ).

In Rose, you can easily use the time sequence diagram to generate a collaboration diagram (collaboration digoal) through the "F5 shortcut ".
Results:
Collaboration diagram of "Login System" Use Cases:

Now, after completing the above example, I believe that the friends who have not done the sequence chart should have a bottom in their hearts.
The robustness diagram and sequence diagram of the "post an article" Use Case are published (this is more to compare with each other and check whether the painting is correct ):

Robustness diagram of "Post" Use Cases

Timeline chart of "Post" Use Cases:



The following is followed by "Browse comments", "delete comments", and "submit comments"

The robustness diagram of the "Browse comments" use case:


The Sequence Chart of the "Browse comments" use case:

The robustness diagram of the "Delete comment" use case is as follows:


The sequence diagram of "Delete comment" is as follows:

The robustness diagram of the "submit comments" use case is as follows:

The Sequence Chart of the "submit comments" use case is as follows:

After the Sequence Graph is drawn, the method and operation are assigned to the corresponding class based on the above five sequence graphs, and
NewStatic ModelAs follows:

After this step is completed, it is necessary to make a preliminary summary to let everyone know clearly from the beginning of this series to the present
There is a general idea about the content. That is:

First, a domain model is generated from the requirement. The Use Case model is a static model. However, in the case model,
Perform robustness analysis, and then find the object, boundary object and control object based on the analysis results.
From the demand analysis to the design stage. In this process, we will find the objects missed during the Domain Modeling stage and introduce
Some objects more relevant to the design. After these objects are analyzed and abstracted, the corresponding domain model is updated to gradually pass through
Transition to static class model (class model is the idea of adding the design stage to the domain stage ).

Based on Robustness Analysis, you can also perform interactive modeling for each use case. This is the core of this article.
Content. Update the class model to obtain a relatively complete static class model.

In the next article, we will talk about how to implement"Key Design Review"To carry out quality review and other work.

Digress:

After reading this static model, you will surely feel that the model itself lacks many classes and operations.
What's wrong with character. In fact, this is also because it was proposed at the beginning of this series of articles: "Only analyze important demands ",
(Of course, I have not analyzed all the important requirements here. The main reason is that there is too little time to write articles.
Sorry. If you are interested, you can add the important content that you think is missing to the Rose file so that you can practice
Opportunity, I am just a little lazy here ).

In addition, one reason for doing so is that if everything is comprehensive, we will feel like "only seeing the forest, not seeing the forest", because
In this series of articles, I mainly talk about the iconix method itself. In each article, I try to focus on
Instead of developing a complete Blog system. Therefore, we hope you will forgive me and understand it.

In addition, the author often analyzes core requirements and develops core functions in the previous design and development process, and then
Other functional modules are developed based on the architecture built by the backbone. I personally think this is a so-called"Iteration Increment"
Development process.

I remember mentioned at the beginning of this series that the iconix method is a method that supports iterative incremental development. And in the contemporary soft
In part development theory, this feature basically exists:

Regardless of the four steps described in the RUP: Inception, elaboration, and constr-
Uction), delivery (Transition ). There is a technical review at the end of each stage to determine whether to proceed to the next stage.
Each stage can be further refined into multiple iterations.

In XP (eXtreme Programming), the goal of maximizing human energy is the core goal, and the "Daily"
Building (small release) "and" planning game "also reflect the idea of iteration (or even regard" user stories"
Is a close relative of the Use Case ")

Back to our development series, where should we iterate?

First Iteration: Capture requirements, complete Domain Modeling and case modeling (and develop a development plan ).

Second Iteration: Robustness analysis of key cases ).
Architecture design.
Interactive modeling.
Create a class model.
Development and testing of important use cases (the use cases analyzed by the requirements marked by red lines in the opening section) and
Submit a runnable version.
Improve the key case model.

Third Iteration: Analyze the priority cases (analyzed by the requirements marked by the Green Line in the beginning)
Design and development, and optimize and adjust the architecture of the second iteration. Also, update the class.
Model. And submit the runnable intermediate version.

... Nth Iteration ....

Last Iteration: Overall testing, implementation, and local installation.


The main content of today's article has been explained :)

Finally, we will list the errors that often occur at this stage. If you have any questions, we can discuss them in the reply :)

Ten Most Common Errors in time sequence drawing

10. Do not draw a sequence chart for each use case.
"You can only find
The system requires the role of each object, that is, the responsibility of each object ."
--- From <the object advantage> of Jacob son)

9. Do not add the case text to the sequence chart.
The requirement-level text of use cases is placed on the Sequence Graph to provide visual requirement tracking, allowing you to refer to
User-defined requirements. Because the sequence diagram must be consistent with the narrative process of the corresponding use case.

8. Do not first determine all required objects on the robustness graph.
If it is difficult to draw a sequence chart, it may be that the written use case is incorrect and/or the robustness analysis is not completed.
With the correct robustness diagram and strictly defined use cases, it is much easier to draw the sequence diagram.

7. visual tracing is not provided between the use case text and the message arrow.
A certain gap should be added between each sentence and sentence segment in the case text so that the corresponding message is located
The same horizontal line. This will help people understand how the system will complete the use case description when reading the time sequence diagram.

6. The communication pipeline between objects is not described, so that time series charts can be abstracted in an advanced manner.
In the robustness diagram, there is no need to describe the communication pipeline between objects because they reflect the preliminary design. But the encoding will
Based on the sequence diagram, the actual design scheme needs to be described in great detail.

5. Draw a sequence chart as a flowchart, instead of allocating behavior among objects.
Used as a decision-making tool for allocation. You will use the time sequence diagram to allocate operations to the class. Do not use arbitrary text
To mark the message arrow, the message name and class operation name should be associated. In the iconix method (
Deciding which operations belong to which classes) is crucial. decisions at this stage determine the overall design quality.

4. focus not on interesting methods (actual software behavior), but on get or set functions.
By studying the behavior of the system, you will know which attributes and methods are required for classes in the static model. When determining the class in time series
After the position in the figure, you should add the corresponding attributes and methods to the class. However, it should be noted that the timing diagram should not be used.
It takes too much time to draw all the getattribute and setattribute message arrows. If this is done
To the expected goal, because it is easy to forget the scene process.

3. Do not carefully consider the start point of the message arrow (that is, the object with control in a specific time period)
Messages between objects call operations of corresponding classes. Although it is irrelevant to accurately drawing arrows in a robustness Diagram
But they must be correctly drawn in the sequence diagram, and the control process must be clear, at any time, which object has
Control must be obvious.

2. the responsibility-driven OOD principle is not followed when a message arrow is drawn to distribute behavior.
Objects (and classes) can only have one "character", so we should avoid "schizophrenia", which means that the class should
The behavior of the same group is closely related, that is, the rule that has been in use for a long time should be followed-the object should be highly cohesive and loosely coupled. Note
Other principles, such as reusability and applicability.

1. Do not create a local class chart for each case package to update the static model.
In the domain model, make sure that the domain classes are "clean", but list the solutions when creating a "localized" static class diagram.
The objects in the solution space and the objects in the problem space are a good idea. The guiding principles are as follows:
Package, draw a local class diagram, this will help to allocate work between groups, also can avoid because of static model
It is too large to show the problems in a picture.

The link to the Rose file is as follows: http://files.cnblogs.com/daizhj/blog_Sequence.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.