If you are looking at modelling tools for your .NET apps Borland’s Together could just be your answer. David McAmis takes a close look at the VS.NET tool.

UML has become a hot topic recently, with developers realising the benefit of modelling as opposed to other methodologies. And one tool designed to take advantage of this interest in UML is Borland Together for Microsoft Visual Studio.NET.

Borland Together comes in a number of different editions and Borland Together for Microsoft Visual Studio.NET is integrated into the Visual Studio.NET IDE and was created specifically for .NET developers.

When you first install Together, an additional link will be added to your Visual Studio.NET start page in the column on the left-hand side. This link provides access to the Together start page, as shown in Figure 1, which has links to tutorials and online help, as well as sample applications that demonstrate Together features. If you are new to UML, you may want to read through the “Introduction to UML” document, as it provides a good background to what UML is and how it can be used.

Figure 1: Together start page

You can start using Together by creating all of the models for your application and then coding from there, or you can use Together to reverse engineer an existing application, letting the application do all of the hard work for you.

Regardless of which method you choose, Together allows you to easily move between modelling and coding. For example, you can quickly switch between a use case and your application code without a minimum of fuss, as shown in Figure 2.

Figure 2: A typical use case created with Borland Together

While Together supports both VB.NET and C#, the majority of advanced features and functionality is available for C# only, including the ability to forward-engineer diagrams into C#. This feature can be used to tie diagrams and code together, so changes to objects, classes, and so on are changed in the diagram when they are changed in the underlying code. This is especially handy if you have a fluid development environment or if your code changes often.

The refactoring capabilities within Together can be used to make changes, additions or deletions within your model and code and there is a warning that kicks in if you attempt to delete an item that would result in compile errors– as with many other refactoring tools, you can view changes before they are made complete.

For auditing C# code, Together provides over 100 different types of audits that you can run against your code, including naming and performance audits, branching and loop audits, expressions and more.

And finally, for generating documentation, Together includes a documentation generator that can document the current namespaces and diagrams in use in your application, generating extensive HTML documentation that you can use as the basis for your own documentation or as a standalone document.

Creating Diagrams and Documentation

To see Together in action, we are going to walk through a common scenario where you might want to use the product. Most structured development projects will utilise “Use Cases” to document the application and how it will be used. Previously, developers were always stuck drawing these use case diagrams by hand or using a diagramming tool like Visio. With Borland Together you can create these diagrams within Visual Studio and have the required documentation automatically generated for you. In this walk through we are going to create a simple use case diagram and then generate the documentation for our development project.

To get started, download and install the demo version of Borland Together from the Borland web site and open or create a new project within Visual Studio.NET. From that point, follow these steps:

  1. Select View > Together VS.NET Model View
  2. Right-click on the name of the application and from the right-click menu and select Add > Other Diagram to open the dialog shown below:

    Figure 3: Diagram options
  3. Enter a name for your diagram and click OK. This will open the blank use case diagram.
  4. From the Toolbar on the left-hand side, drag an actor onto the page and label it “Administrator”
  5. Next, drag a use case “bubble” from the Toolbar and label it “Enter and verify opening balances”
  6. Finally, drag another actor onto your diagram and label it “Accountant”
  7. To join the actors to the use case, drag a communications link between them, as shown below in Figure 4.

    Figure 4: A simple use case
  8. Now that your use case is finished, you can now auto-generate the documentation for your project. In this example, we haven’t included any code but if you did have code in your project that would be documented as well.

So the first part of our walk-through is complete. Next, we are going to generate the documentation for our project. To do so, follow these steps:

  1. Select Tools > Generate Documentation to open the dialog shown below in Figure 5:

    Figure 5: Code generation options
  2. Select the option to generate “All” in the scope option box and specify a location for your Output. Make sure that the options to include diagram and launch the browser window are checked and click OK. Together will work behind the scenes to document your project and then open a browser window to display the documentation, as shown below in Figure 6:

    Figure 6: Generated documentation

And that is all there is to it. This is a simple example of how to get started with Borland Together, but you can find more walk-throughs and examples in the online help that ships with the product or from the Borland Developer Network web site.