.NET
  Home arrow .NET arrow Examining the UML Models: Static Models
Moblin
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

Examining the UML Models: Static Models
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 11
    2005-04-20

    Table of Contents:
  • Examining the UML Models: Static Models
  • Classes
  • EXERCISE 5-4
  • EXERCISE 5-7
  • Relationships
  • Generalization Relationship
  • States
  • Components
  • Dependencies
  • Code Generation from a Component Diagram
  • Nodes
  • Stereotypes
  • Summary

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    Examining the UML Models: Static Models


    (Page 1 of 13 )

    Have you ever wanted to learn more about the structural diagrams used in UML? This article discusses four important types. It is excerpted from Enterprise Development in Visual Studio.NET, UML, and MSF, by John Erik Hansen and Carsten Thomsen (Apress, 2004; ISBN 1590590422).

    IN THIS CHAPTER, we'll introduce you to the UML diagrams known as structural diagrams, which describe the structure (static structure) of your solution. The following UML diagrams are structural diagrams:

    • Class diagram

    • Statechart diagram

    • Component diagram

    • Deployment diagram

    As in Chapter 4, we’ll describe the frequently used diagrams in detail and use VEA 2003 for the exercises. These exercises are simple, yet they do teach you how to work with the UML models in VEA. Do yourself a favor and follow the exercises, especially if you’re new to UML and/or VEA.

    In this chapter, you’ll see the code generation, which you didn’t see in Chapter 4. The reason for this is that all code generation is based on the static structure diagrams (class diagrams).1 You’ll also learn about stereotypes, which are basically a way to extend the UML specification by making a subtype appear as an ordinary element. At the end of the chapter, we’ll show you how .NET code maps to UML.

    Class Diagrams

    The class diagram is the most essential part of UML modeling, because you determine in your class diagram how the (static) structure of your solution should look, modeled at the most detailed level. In your class diagram, you can see which classes, COM+ components, ASP pages, and so on will be implemented and how they interact with each other. COM+ components, ASP pages, and so on are simply classes with another stereotype, as you’ll learn in this chapter.

    When the developers develop the solution, their main source of information is the class diagram. The class diagram provides developers with detailed information about what operation code to develop, along with information about data types, parameters, and namespaces. If the developers need some supporting information about the behavior of the solution, they will look at the behavioral diagrams, such as the sequence diagrams and activity diagrams.

    Another reason why class diagrams are the most important part of your UML modeling is that you can generate code only from your static structure diagrams, and your class diagrams are the only diagram type from which you’ll have a code skeleton for ready use in VS .NET.2 Class diagrams basically consist of the following elements:

    • Packages

    • Classes

    • Relationships

    We’ll look at each of these elements in the following sections.

    Packages

    You’ve already been introduced to packages in Chapter 4. Packages can relate to different issues, depending on which diagram are implemented. For class diagrams, a package has two functions:

    • A package can be created to group related elements. This can be very useful if you want to form a general view of the model.

    • A package can represent a namespace.

    In Exercise 5-1, you’ll create a class diagram named MyClassDiagram with a package named MyNamespace, as shown in Figure 5-1.
    Figure 5-1.  Class diagram with a namespace (package)


    EXERCISE 5-1

    1. Open VEA, if it is not already open.

    2. Create a class diagram named MyClassDiagram.

    3. Create a package named MyNamespace.

    4. Drag a class to the MyClassDiagram diagram and name this class Customer.

    5. Drag the Customer class in the Model Explorer window onto the MyNamespace package. Notice that the Customer class placed on the MyClassDiagram diagram now has the Namespace specification attached.


    NOTE We’ve noticed a bug in VEA: If you create a package in an empty model, the package classifier might not show on the class. To solve this problem, create a new package and delete the first one.

       6.  You can generate the code for the class and namespace by
            selecting UML -> Code -> Generate. In the Generate dialog box,
            choose Visual Basic as the target language, check the Customer
            check box, and specify the path      
            as\EDWVSNETUMLMSF\Chapter05\, as shown in Figure 5-2.
            Click OK.


    Figure 5-2.  Generate dialog box with the Customer class

       7.  VEA now generates the file \EDWVSNETUMLMSF\Chapter 05\
            TopPackage\MyNamespace\Customer.vb, containing the code
            shown in Figure 5-3. Double-click to open the file in VS .NET.


    Figure 5-3.  VB.NET code generated for the Customer class

    Figure 5-4 shows the code for the Customer class generated with C# as the target language.


    Figure 5-4.  C# code generated for the Customer class

    As you might have noticed, Package shapes are located in the Model Explorer window as well. You can see the MyNamespace package and the Top Package. As you learned in Chapter 4, the global namespace is the global package, and it is named Top Package by default. You’re allowed to have multiple nested packages. To nest a package, just drag a Package shape under another Package shape in the Model Explorer window. (In Chapter 12, you’ll learn what the other Package shapes in the Model Explorer window represent.)

    More .NET Articles
    More By Apress Publishing


     

    Buy this book now. This article is excerpted from Enterprise Development with Visual Studio .NET, UML, and MSF written by John Erik Hansen and Carsten Thomsen (Apress, 2004; ISBN: 1590590422) Buy this book now.

    .NET ARTICLES

    - More on Commands, Input and the WPF
    - Grouping and Aggregating When Querying LINQ ...
    - Commands, Input and the WPF
    - Keyboard and Ink Input with WPF
    - Mouse Input and the WPF
    - Input with Windows Presentation Foundation
    - Introducing LINQ with XML and Databases
    - An Introduction to LINQ
    - Querying LINQ to SQL: Basics
    - Completing a Simple Storefront with LINQ
    - Knowing Your Environment: the System.Environ...
    - Creating the Home Page for a Simple Storefro...
    - LINQ Quickly with Language Integrated Queries
    - Introducing LINQ to SQL Designer using Visua...
    - Beginning LINQ to SQL Using Visual Studio 20...




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway