Tuesday, July 08, 2008

New features in VSTS "Rosario": Architecture Explorer And Class Dependencies

Architecture Explorer is a WPF interface that allows us to explore our solution. To open Architecture Explorer, we only have to select Architecture Explorer on View menu.

In my previous post, I use Architecture Explorer to generate a Sequence Diagram. Now I go to explain how to see all class dependencies inside our solution.

I added to my sample project, a new class FormatMessage, that modify the returned message from HelloWorld class.

The code in my form (Form1) when I click the submit button is:

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim helloClass As New HelloWorld(txtName.Text)
Dim formatMessage As New FormatMessage(helloClass.SayHello())
lblHelloName.Text = formatMessage.CustomMessage()
End Sub

My class Form1 has dependencies with HelloWorld class and with FormatMessage class. We can see this dependencies from the Architecture Explorer:

Click on View -> Architecture Explorer menu and choose:

Column 1) "TestingSequenceDiagrams" Solution
Column 2) Contains
Column 3) "TestingSequenceDiagrams" Project
Column 4) Contains
Column 5) "Form1", "HelloWorld" and "FormatMessage"

And the result is...

From this diagram, I can navigate through the code, clicking the class shapes.

Saturday, July 05, 2008

New features in VSTS "Rosario": UML Sequence Diagram

I have download the April 2008 CTP Visual Studio Team System Code Name "Rosario" VPC Image to test the new features.
In this article I will talk about the Sequence Diagram feature. In VSTS "Rosario" we can either create a sequence diagram from scratch and generate the associated code or we can write our code and using reverse-engineer to generate our sequence diagram.

For example, I write a sample solution "TestingSequenceDiagrams" with a project "TestingSequenceDiagrams" with a typical "Hello World" windows form application with a form (Form1), a button (btnSubmit), a textbox (txtName), a label (lblHelloName) and a HelloWorld class with a SayHello function. The btnSubmit click event code is:

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim helloClass As New HelloWorld(txtName.Text)
lblHelloName.Text = helloClass.SayHello()
End Sub

Next, I add a new blank sequence diagram: Right button at the project element -> Add -> New Item... -> Common Items -> General -> Sequence Diagram.

Next step is going to View -> Architecture Explorer menu and choose:

Column 1) "TestingSequenceDiagrams" Solution
Column 2) Contains
Column 3) "TestingSequenceDiagrams" Project
Column 4) Contains
Column 5) "Form1"
Column 6) Contains
Column 7) "btnSubmit_Click"
Column 8) Insert into Active Diagram

And the result is the btnSubmit_Click method sequence diagram...