Pausing to Consider Design Issues

 < Day Day Up > 



Creating Use Case Diagrams

The new robot rat project specification offers a lot to think about. The best way to begin to tackle the project is to solidify your understanding of the requirements by creating several use case diagrams. Start by creating a new project in Describe™ to which you can then add the necessary diagrams. Figure 20-3 shows the Create New System window with the name of the new system being set as RobotRat.

click to expand
Figure 20-3: Creating the New RobotRat System

In the Create New System window you can set the system location, assign it to a particular group, add a brief description, and define the type of methodology to use in the diagrams. You can additionally link to a requirements document or integrate with the Telelogic DOORS™ requirements management system, and password protect the system. Click the OK button to create the RobotRat system.

With the RobotRat system created you can now add the use case diagrams. From the File menu select New Diagram as shown in figure 20-4.

click to expand
Figure 20-4: Adding a New Diagram

You will get a dialog window asking you to name the new diagram and to select the type of diagram you wish to create as shown in figure 20-5.

click to expand
Figure 20-5: Creating Use Case Diagram

When you have named the diagram (I named this one Use_Cases) and have selected the diagram type click OK and you are ready to create the use case diagram for the robot rat project. Figure 20-6 shows a partial use case diagram for robot rat functionality from the user's perspective with a new use case named Create New RobotRat being added.

click to expand
Figure 20-6: User Perspective Use Cases

The various use case diagram elements can be added by selecting them from the tool bar. Diagram elements can be thoroughly documented when they are added to the diagram.

Adding Documentation to Diagram Elements

Figure 20-7 shows the Properties Editor window for the Add New RobotRat use case.

click to expand
Figure 20-7: Adding Documentation via the Properties Editor Window

In addition to adding brief descriptions to diagram elements Describe™ offers the capability to link each diagram element to supporting documentation. Figure 20-8 shows the Properties Editor window for the RobotRat User actor. Documenting your diagrams as you build them is a good habit to develop and offers many benefits. (I like to call this 'document-as-you-go') Primarily, it helps you clarify your design to yourself. If you have trouble explaining the reason for each diagram element to yourself then perhaps you need to rethink the need for the element.

click to expand
Figure 20-8: Linking to External Documentation via the Properties Editor Window

The next obvious benefit of document-as-you-go is you do not have to stop your design and development efforts to go back and create all your documentation. If you practice document-as-you-go you will end up with more than enough design documentation, in addition to any diagrams you create. You will see the results of document-as-you-go when you generate project web reports. Figure 20-9 shows the completed robot rat user's perspective use case diagram. Each diagram element is documented and linked to the requirements document.

click to expand
Figure 20-9: Completed Robot Rat User's Perspective Use Case Diagram

It seems, from studying the complete user's perspective use case diagram, that all user functionality is captured. A robot rat application user can create new robot rats, select which robot rat to move, move the selected robot rat, set the robot rat's tail up or down, print the floor pattern, and exit the application. Notice how the Move RobotRat use case depends on four individual directional move use cases. The note in the upper-left corner of the diagram drives the point home that this diagram is expressing robot rat functionality from one particular actor's perspective - the user.

Programmer Perspective Use Cases

An important use case perspective to consider when designing an application and its supporting architecture is that of the programmer. Explicitly building programmer perspective use cases forces you to consider what features the application architecture must support to satisfy the project requirements. In real life, architectural requirements are often not explicitly stated or clearly understood by designers. However, when a client says to the contractor 'I want to be able to add functionality to the application over time' what they are saying essentially is that you the contractor must build into the application the ability to accept new and possibly unforeseen features. The ability of the application to grow gracefully is a requirement in itself and the application architecture must be designed to do so.

The robot rat project specification makes its architectural requirements fairly clear. It says that the robot rat application must have the ability to add different types of remote controlled objects should the need arise. This requirement has a significant impact on the design of the inheritance hierarchy and class relationships.

Another requirement stated in the robot rat project specification is the use of the Model-View-Controller (MVC) pattern to separate the user interface from the rest of the program. Although patterns are not covered formally in this book, the use of the MVC pattern is necessary to achieve the stated requirements. Figure 20-10 shows the use case diagram for the application functionality from the programmer's perspective.

click to expand
Figure 20-10: Programmer Perspective Use Cases

As illustrated in figure 10-10 the robot rat application architecture must be able to accommodate new types of remote controlled objects, however, version 1.0 of the new and improved robot rat application will only allow the user to add more robot rats to the floor. The application architecture must also have a separate user interface class, a separate controller class, and a separate robot rat manager class.



 < Day Day Up > 



C++ for Artists. The Art, Philosophy, and Science of Object-Oriented Programming
C++ For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504028
EAN: 2147483647
Year: 2003
Pages: 340
Authors: Rick Miller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net