日期:2011-02-20  浏览次数:20475 次

Visually Model Software Applications
Note: Some features may not be offered in the publicly available Visual Studio.NET Beta 2.
Customers building complex distributed applications face the challenge of successfully communicating application architecture and requirements across a broad range of team members. This challenge compounds as we move into the world of loosely coupled XML Web services. It is common knowledge that the presentation of concepts and information in multiple formats—visual, spoken, written—enhances people's ability to understand messages quickly and accurately. Taking this multiple-format approach to communicating, Visual Studio.NET helps foster team coordination and productivity by providing a rich set of visual modeling tools for specifying application architecture and requirements.

An Industry-Standard Approach
Visual Studio.NET delivers support for a full range of design and modeling activities, including freeform diagramming capabilities as well as a set of industry-standard Unified Modeling Language (UML) diagrams. UML is a notation for visually describing and interpreting the pieces, relationships, and actions that comprise a software application.

With the Visual Studio.NET modeling features, users can create sophisticated diagrams to specify their application architecture and business requirements, and can communicate these across their teams. Business analysts, architects, developers—and others who want to perform analysis and design tasks to enhance communication and increase the productivity of their development teams—can take advantage of these new capabilities. The following scenario demonstrates how the structure of a particular software system can be visualized and more effectively communicated by using software models created in Visual Studio.NET.

Application Scenario: A Car Rental Software System
This scenario discusses how the eight UML diagram types might be used to model a car rental agency's software system. Beginning with three simple use cases, the examples capture the core processes in the system.

Use Case Diagram
A use case specifies an interaction between a user and the system in which the user is able to achieve a goal. A typical software system might include hundreds of simple use cases. Some use cases applicable to the rental agency's system are:

Customer reserves car
Before obtaining a car, a customer must make a reservation. The customer contacts the rental agency and makes a request. The agency accepts or declines the request based on a number of criteria, such as the availability of cars or the customer's rental history. If the reservation is accepted, the agency completes a form containing customer details. Payment of a deposit completes the reservation.
Customer picks up car
When the customer arrives at the agency, the rental agency allocates the model of car requested by the customer, depending on current stock levels. After paying the full fee, the customer receives the car.
Customer returns car
The customer returns the car to the agency on the day specified in the rental agreement.
The following image depicts the use-case diagram for these three use cases.


Figure 1. A simple use case diagram

Static Structure (Class) Diagram
The next task is to classify the objects involved and their relationships. Examining use cases helps identify classes. Classes of objects are modeled using static structure, or class, diagrams that show the overall structure of the system, as well as relational and behavioral properties.

In a class diagram, the objects involved in the car rental system are grouped into classes. Each class contains a name section and an attribute section. Some classes also include an operations section, which specifies how objects within that class may behave.

In the Customer class, attributes include name, telephone