Ok, over the next few, several, or many blog entries, I hope to demonstrate how to use the UML tools in Visual Studio Ultimate and how to use these tools to validate your project. (Note that I moved the blog titled to the correct blog: http://blogs.msdn.com/b/socalsurf )
- UML: Unified Modeling Language
- Level of proficiency required: none
- Tools required: Visual Studio Ultimate 2010
First, let’s define what a model is:
- A model is an abstract representation of a specification, a design, or a system as defined by interaction between system users, builders and maintainers.
- A model can be dynamic or static, usually models are static in nature requiring constant review by the people involved.
- The human cannot be eliminated, but the human fallacies such as boredom and continuity can be augmented by the use of a dynamic modeling system.
Why UML and not Domain Specific Language or DSL?
- DSLs will be investigated later, UML has been added into Ultimate for 2010 and I thought an exploration would more interesting, DSL has been part of Visual Studio 2005 Team System, DSLs require more work than UML
- UML has been a standard since 1997. With more than a decade of broad use, UML is a more standard (but less specific) way to communicate ideas than a DSL.
- UML was not created to satisfy the needs of a particular development language or platform. UML can describe object-oriented concepts just as easily for a system that is written in Java and runs on Linux as for one that is written in C# and runs on Windows.
- UML has implementation costs that are lower than DSLs at first, because the UML tools are included in Visual Studio, while DSLs must first be developed.
- UML can be used to create approximate descriptions of real systems when the domain in question is not well understood. As such, it is often used for documentation.
- Source: http://msdn.microsoft.com/en-us/architecture/ff476944.aspx
Do the following:
- Open Visual Studio 2010 Ultimate
- Select the Visual C# folder
- XNA Game Studio 4.0, then Windows Phone Game (4.0)
- Name the project SpaceSprockets (or another name, but when you see SpaceSprockets substitute your Solution Name
- Click Ok
In Visual Studio Ultimate select:
- Architecture Menu
- New Diagram
You are now ready to do UML, the class diagram component will be discussed later, the class diagrammer is included in the VS 2010 Professional.
Now select UML Use Case Diagram
What is an UML Use Case Diagram?
Simply: Use Cases document the behavior of the system from the user point of view
In the case of most of my thinking these days, it is oriented on the game player.
Let’s write a “use” case:
- A game consists of avatars, walls, doors, scoring feedback, Sound Effects and music
- A game player can play one game at a time
- A game player will be represented by a single avatar that cannot be changed during the play phase of the game
- The game player can change their avatar image prior to the start of the game, during pauses in the game, and before leaving the game
- The game engine will control the location of opponents, friendly avatars, walls, door and appearance of levels to the game player
- The game player’s avatar will interact with the other objects under the control of the game engine
Using VS Ultimate, I created the simple use case (or what I consider to be a use case) shown below.
- My user image was replaced with the cute Game Player and I colored the Use cases to make them more interesting
- The Game Player (user) selects one of the avatars on the Windows Phone Screen
- The selection is dependent on the interaction with the other avatars and move use cases
- The use case may not be correct, as time goes on the correctness of the use diagram can be changed, it is a very high level diagram
Make sure to take a look at the blog Game Theory by Dan Waters: