.NET
  Home arrow .NET arrow Page 9 - Examining the UML Models: Static Models
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 
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


    Examining the UML Models: Static Models - Dependencies


    (Page 9 of 13 )

    Dependency is a relationship indicating that one element is dependent on another element to function. Say Component1 is dependent on Component2, which means that changes in Component2 will affect Component1, because Component1 uses services or facilities in Component2, and not the other way around.

    For example, you might have a component in which some of the classes call a class in another component. Well, why not package all classes in the same component then?12 It defeats the idea of creating unique components that hold only classes that can be grouped because they expose the same kind of functionality. It’s like when you’re at the grocery store; you don’t look for apples in the basket with oranges, do you?

    Establishing dependencies has another benefit in that if your component crashes, it will directly affect only one type of functionality. It shouldn’t bring other types of functionality down with it.

    In Exercise 5-17, you’ll add a dependency between two components in your component diagram.

    EXERCISE 5-17

    1. Open MyComponentDiagram.

    2. Add a dependency between Component1 and Component2.


    In Figure 5-25, you can see that Component1 is dependent on Component2, illustrated by the dependency (dashed line).

    Interfaces

    Of course, you know about your model’s public interfaces by looking at your public functions in the classes. However, if you have a component representing a third-party DLL, you might not know about the public interfaces, because you haven’t modeled the classes and functions. That’s when the interface element of a component diagram can be useful.


    Like any class, an interface needs at least one operation, and operations can have parameters. In Figure 5-25, the Imageshrink.dll component represents a COM+ component purchased from an external vendor. The _Imageshrink interface is the COM+ type library. A type library is required to expose the interfaces to users of the component. The interfaces exposed are illustrated as operations on the Interface shape. In Exercise 5-18, you’ll add an interface that has one public operation, Shrink, to your component diagram. This operation will represent a function and have three parameters.


    EXERCISE 5-18

    1. On MyComponentDiagram, add an interface named _Imageshrink to the Imageshrink.dll component. The Interface shape is the lollipop, as shown in Figure 5-25.

    2. Double-click the _Imageshrink interface to open the UML Interface Properties dialog box.

    3. Select the Operations category.

    4. Click New to add a new operation named Shrink, of data type VB::Object (C#::object if you want to code in C#), as shown in Figure 5-27.


    Figure 5-27.  Operations category of the UML Interface Properties dialog box

       5.  Click OK.


    NOTE You can’t tell from the Model Explorer whether the operation returns a value. You need to open the UML Operation Properties dialog box to get that information.
     

       6.   Double-click the _Imageshrink interface to open the UML 
            Interface Properties dialog box and select the Operations 
            category again.

       7.   Select the Shrink operation.

       8.   Click Properties to open the UML Operation Properties dialog box.

       9.   Select the Parameters category.

      10.   Click New to add a new in-going parameter named BMPImage of
             data type VB::Object (or C#::object if you want to code in
             C#).

      11.   Click New to add a new in-going parameter named 
             ShrinkPercentage
    of data type VB::Integer (or C#::int if you 
             want to code in C#). Your UML Operation Properties dialog box 
             should look like Figure 5-28.


     Figure 5-28.  Parameters category of the UML Operation Properties
                           dialog box

      
      12.   Click OK twice. In Figure 5-29, you can see how the
              _Imageshrink interface looks in the Model Explorer.

     

               Figure 5-29.  Interface shown in the Model Explorer


    NOTE
    As you can see in the Model Explorer, the Shrink interface has three parameters: Shrink, BMPImage, and ShrinkPercent. What you can’t tell from the Model Explorer is if a parameter is an input or output parameter. You need to open the UML Operation Properties dialog box to see this information.

    When developing COM+ components to run in the COM+ runtime environment of Component Services, you need to instantiate the ObjectControl interface of the COM+ runtime environment and add three operations to your component: Activate, Deactivate, and CanBePooled. In Figure 5-30, you can see how the ObjectControl interface could be added to the Imageshrink.dll component in our example. You’ll add the ObjectControl interface in Exercise 5-19, in the next section.


      Figure 5-30.  COM+ component with the ObjectControl interface

    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 5 hosted by Hostway