ith the introduction of Microsoft’s .NET platform, vendors of modeling tools such as Rational XDE have moved quickly to support the platform. These vendors and others have added support for the C#.NET language and to a lesser extent .NET features such as ASP.NET, Windows Forms, Web Forms, and Web Services.
In this article, we’ll look at two tools for modeling .NET applications: introductory-level Microsoft Visio, and full-featured Rational XDE Professional v2002 .NET Edition.
Integration with Visual Studio.NET
.NET developers spend most of their day working inside Visual Studio.NET (VS.NET), so switching back and forth between a separate modeling tool and VS.NET can be cumbersome and error prone. Vendors of modeling tools are solving this problem by providing a tighter coupling with VS.NET in a variety of ways.
Visual Studio.NET Enterprise Architect Edition has Microsoft Visio included with the package, but Visio is loosely coupled to VS.NET. Menu items added to VS.NET activate modeling functionality in Visio, but Visio is run as a standalone application. This level of integration with VS.NET is the most common one among modeling tools, because the tools are generally based on standalone applications.
Rational XDE is an example of an application with a much closer integration with VS.NET. The first thing you observe about Rational XDE is that it is hosted entirely within the user interface provided by VS.NET. This design blurs any distinction between a modeling tool and a coding tool by sharing the same menu structures, interface, and usage metaphors. This high level of integration is a significant improvement over XDE’s predecessor, Rational Rose.
Another benefit provided by sharing the same user interface is the ability to look at a UML diagram and matching source code in adjacent windows. This feature helps developers build a better understanding of UML as they can quickly relate elements in the model to more-familiar source code constructs.
Support for Round-Trip Engineering
As UML tools have evolved, the level of integration between model and code has increased dramatically. In the early days of UML tools, modeling and coding were separate activities. That is, a developer would model the application first and then write code to implement the model. The process of implementing the model was simplified when support was added for forward engineering, which automatically generates code directly from the structure specified by the model.
The next big step forward came with the introduction of reverse engineering, which analyzes an existing code base and translates it into UML model elements?Classes, Attributes, Methods, Interfaces, and so forth. Reverse engineering is a popular feature of modeling tools because it enables modeling of legacy code bases without requiring tedious construction of the initial model. A modeling tool that can seamlessly blend forward and reverse engineering is said to support round-trip engineering. This feature enables independent changes to the code and model to be synchronized. A developer can work in whatever domain is more productive and see the results of the changes in the other domain.
The degree of support for round-trip engineering of .NET applications varies by tool vendor. The Visio-based modeling tool in VS.NET supports forward and reverse engineering with some caveats. Its forward engineering feature is capable of generating new VS.NET projects, but does not yet support updating an existing VS.NET project. Similarly, Visio can reverse engineer to generate a new UML model easily, but it does not yet support updating an existing model with relevant changes.
By contrast, Rational XDE supports round-trip engineering with continuous synchronization between the code and model elements that removes the need for separate forward and reverse engineering steps. Options are provided to control the frequency of code/model synchronization or to disable it entirely for selected elements if performance problems arise with large models. The round-trip engineering functionality within XDE supports applications developed in C#.NET, Visual Basic.NET, and ASP.NET.
Support for Design Patterns
Design patterns have become very popular since publication of the book Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (frequently referred to as the Gang of Four or just GoF). Although the concept of a design pattern is not specific to .NET or any other platform, a developer could create patterns that leverage features of the .NET platform.
Rational XDE has built-in support for design patterns; it provides twenty-three generic GoF patterns along with supporting implementations in C#.NET and Visual Basic.NET. The GoF patterns can be used unaltered or they can form the basis of new patterns. This tool provides a wizard interface for applying patterns that takes into account the unique attributes of each pattern. The behavior when patterns are applied is configurable, so that patterns can merge, replace, or preserve existing model elements. Code in the target .NET language can also be generated during pattern application through support for the binding of code templates to specific UML elements. Visio does not handle design patterns.
And for Web Patterns
The .NET platform offers features such as Web Services and Web Forms that are based on an underlying ASP.NET implementation. Application logic for processing ASP.NET server controls usually resides in a separate file from the ASP.NET code. This file is called the code-behind file and contains a supporting class which is inherited by the .aspx, .ascx, or .asmx file. The wizards in VS.NET make it very easy to create these types of advanced services by effectively hiding this complexity.
Modeling tools that support .NET should be able to represent the relationships between the object hierarchies created by VS.NET wizards. When approaching software design from a model-first-and-code-later perspective, it is also useful if the tool supports adding the corresponding UML elements for .NET features like Web Services to model without being required explicitly to add each element to the model.
When you use Rational XDE to reverse engineer a Web project that contains a code-behind file, Rational XDE creates an unstereotyped class in the model to represent the code-behind file. The relationship between an .aspx, .ascx, or .asmx file and its code-behind class is represented using a Generalization relationship, which indicates inheritance from the code-behind class. During a round-trip engineering cycle the tool will automatically generate the code-behind files for code-behind classes that were added to the model.
Simplifying the addition of .NET features like Web Services to a model is accomplished in Rational XDE through a set of Web patterns. When one of these patterns is applied, it will add the necessary class and association elements to the model in a single operation. Web patterns are provided for the three types of ASP.NET code-behind classes?Web Services, Server Pages, and User Controls. XDE also defines a set of stereotyped directed associations that are used to model the relationship between ASP.NET objects. These can be used to represent relationships such as the linkage from a Web Form to a server or an HTML page.
While Visio is capable of reverse engineering of Visual Basic and Visual C++ code, it does not currently support Web patterns or design patterns.
It is clear from the commitment Rational has made to the .NET that it views the platform as a significant destination for new projects and for the migration of existing code bases. As such, UML and MDA tools from Rational and its competitors will become a more integrated part of the development cycle. As such, designers and programmers who are considering .NET should avail themselves of these emerging technologies.
These vendors offer modeling tools that support the .NET platform to various degrees.