Abstract In this paper, examples of the way, showing how to use UML for Object-Oriented Analysis and Design. This article assumes that readers of UML, object-oriented areas such as the basic content of which has been very clear in the chest, so will not elaborate too much, and to focus on the application process. The purpose of this paper is an example of a complete display of the UML-based OOA & D process, a simplified model, to help my friends a better understanding of UML in OOA & D in the role.
Some of my friends have often heard complaining that the school do not know how to use UML, or a painting but do not think there is the role of UML. In fact, the UML itself, it is just a communication tool for the standardization of the exchange as a symbol, in the OOA & D process between developers and even between developers and customer messages. In addition, UML can also be seen as a manifestation of OO form of thinking can be said that "OO is a God, and the UML is a type." Therefore, I would like to make good use of UML, a solid ideological foundation of OO is essential. However, UML is applied to the development process when there is a certain model can be followed. (Note that the model rather than a dogma, I am given the following process is a heuristic process and is not to say that this process must be followed.) The following, we adopt a systematic analysis of CMS design example, take a look at how to apply UML the actual development.
1. From Requirements to Business Use Case Diagram
OOA & D the first step is to understand user needs, and will convert it to business use case diagram. Demand for our CMS system is very simple, generally described as follows lesson: This system is mainly used to issue a press release, administrators only need one, can log on in the background after the press release. Anyone who can browse the news, views can be registered as a system member, registered to comment on the news. Administrator can be in the background of news, reviews, registered members of management, such as modify, delete and so on.
Demand described above, we draw the following business use case diagram:
Here should pay attention to three points:
1. The business use case is the only system of concern to the business use case point of view, rather than the specific system use cases. It described as "the realization of what the business" rather than "what the operating system." For example, in the actual system, the "Sign in" sure to be a use case, but this is the operation of software systems, and users of concern to business is not included in the "Sign in" the.
2. Business customers use case contains only "interest" content.
3. The business use case of all the use cases should enable our customers to understand, if a customer use case can not read the name of what is meant, it may not be suitable for business use case.
2. From a business use case diagram to activity diagram
Completed a business use case diagram, we must for each piece of the business use case activity diagram drawing. Activity diagram to describe the business use case, users may be carried out in sequence. Activity diagram has a very important mission: use cases from business use-case analysis of the system. For example, the following is a "news management" activity diagram:
Can see that a "news management" of the business use case, decomposition of N multi-system operation. Here to pay special attention to these operations, many of which are "activities" are likely to be a system use case (of course, not everyone is). For example, the activity diagram can be seen, the system should at least include the following options for system use case: log in, write-off of the registry, view the news list, edit news, delete news.
In this way, each business use case is to map out the corresponding activity diagram, and then the "activities" integrated system on all options come with cases.
3. From the activity diagram to the system use case diagram to identify all cases of alternative systems, we want to merge and filter them. Is to merge the same into a use case, screening is not in conformity with the conditions of system use case Use Case options removed.
A system use case should be the actual use of the system carried out by a user operation, for example, "See News list" can not count on a system use case, because he only used a system of a sequence of cases.
End of the day we come to the system use case diagram is as follows:
4. From the system use case diagram to the Statute of the use case
System use case diagram to draw, we should be a system for each use case use case given the statute. Statute on the use case, not a common format, it can be used to carry out the preparation of the format. The only use case for the requirements of the statute is "clear and easy to understand."
The following is the "Sign in" the system use case of a statute:
5. Drawing business class diagram
Completed the steps above, the following business areas should be drawing the class diagram. The so-called business class diagrams to describe three things:
1. What are the entities of the system.
2. What do these entities operate.
3. The relationship between entities.
Would like to emphasize here: This is not the entity Actor, but the Actor using the system calls used by the entity in the system is within the boundary of the entity. For example, the administrator will not appear as an entity here, because outside the borders of the administrator in the system, it can work all the three categories by calling the method. And, where "registered members" is not just with entities were registered members of this map Actor, but as a system of business entities for use of the Actor. For example, the registration of which is to use a registered member of the Actor, and remove the other hand, is used by the administrator of the Actor.
This understanding of the importance of the above, I often see the result of confusion between the entities and the relationship between Actor and lead to draw class diagram of the area of distribution of responsibilities is not accurate or inaccurate.
You may also notice that we did not give here the properties of each entity. In fact, in the field of analysis stage, the attributes of entities is not important, it is important to identify the entity's operation.
6. Drawing class diagrams to achieve the above steps, that is, the process of analysis. The following step is designed.
Analysis of the design is not well described, because analysis is "client side", it is only concerned with the functions of the system itself and business, and not concerned about any computer-related things. However, the design and platform, language, the development of closer relations between the model and so on, making it difficult to find a consensus process. However, in general during the design process is to achieve the type of map drawing.
The realization of class diagrams and class diagrams are not the same as the field, it describes the static structure of the real system, and the final code is not one of those. Therefore, it is closely related to the platform, the system must be accurate given the entity type, control type, interface type, interface elements, as well as the relationship between them. Therefore, the realization of class diagram is very complex, but also technology-related platforms. Therefore, I can not give an accurate realization of class diagrams, but for the sake of description, I was given the realization of a simplified class diagram, of course, it is not accurate, but only from the realization of the form class diagram is given look.
We assume the system to build on. NET 3.5 platform, and that the use of ASP.NET MVC as a layer, the overall use of the three-tier structure. In that case, the user module system is the realization of the whole class diagram like this (inaccurate):
7. Drawing sequence chart
With static structure, dynamic structure we have given, in this way can we see the types of systems is how to interact in order to effectively help the work of programmers coding.
The figure given is the user login sequence chart. First of all registered members as the Actor, to call the Login method UserController start sequence, and then sequence the steps in accordance with the icon. UserServices as a business component in which, first of all call data access components GetByName to determine whether the user exists, if it exists, and then call GetByNameAndPassword to determine whether a password is the password for this user. To complete business functions.
Should be noted that the sequence diagrams in practice is a lot of, almost every type of method with the corresponding sequence diagram.
8. Followed the steps in the process of completion of the above, you can encode, debugging, testing and other work. However, these have been beyond the scope of this article.
In this paper, given the use of UML for OOA & D process. Of course, due to the smaller sample, but I am limited, so given the relevance of the content may not be accurate. Software analysis and design was not a fixed mode of the process, with the whole process of the different systems vary. Just think of this article to a forward role, so that my friends generally know the use of UML process. As for the actual analysis and design, but also requires in-depth study and practice of accumulation.