SDMS / VisioTool - Controller completed w/unit test - MAF

If like me, you were dismayed to learn that Visio for Architects was not supported in Visual Studio 2008  you'll appreciate this upcoming tool; particularly if you want to reverse engineer your code so that you can create your UML diagrams without having to manually input all the class information.  

Fortunately there is a workaround (I posted it HERE) which this utility performs.  Without it there was quite a bit of grunt work involved - enough for me to push architecture to the back-burner.   With a new requirement on the front burner I wasn't afforded this opportunity (to back-burner architecture).  There are to many components for me to wrap my mind around the solution, so I'll have to architect the existing WPF Calculator to prepare a gap analysis so that I can successfully create a Managed Add-in Framework (MAF) module loader for my CompositeWPF SDMS solution. 

For those that can't wait for the UI to be completed (like me) I completed the TDD of the controller - the process is fully functional.   The two test that actually perform the work are remarked out (not shown in the screenshot below) because I don't want to inadvertantly convert the solution; I have my Visio document and have to back burner this utility for now.

Note below that the logger trapped some warnings.  I created test for invalid files as well as non-existent files and the test passed as I attempted to crash the process. 

After manually running the "Controller_CanPrepareVS2008SolutionForArchitecture" test I was able to open up my solution in Visual Studio 2005 - note that there are two projects that did not open - at a glance it looks like the WPF related projects (I have some more research to do).  Since CALDemoApplication is on the "New" side of the gap analysis and the DemoApplication is mostly UI stuff I can worry about them later - what I needed was the main solution projects (which I have below).  Updated: unfortunately UI has a great deal of logic in it (more below).

With my Visio document in hand I manually ran the "Controller_CanRestoreFromArchitecture" unit test and was able to successfully reopen my solution in Visual Studio 2008, compile and run the application with no issues.

IMPORTANT NOTE:  when I was closing the Visual Studio 2005 solution (after creating the visio document) I responded "No" to save solution updates.

Note: I manually added the newly created DemoApplication.vsd document to my solution
 

Source code for above available at HERE - Change Set 23906.    App | VisioTool | VisioToolModule and VisioToolModule.Tests

This is somewhat off topic but very cool so I'll mention it - below is the LINQ code I use to get my project list out of a Visual Studio 2005 / 2008 solution:

I created the query using LINQPAD - more about this HERE

UPDATED:  I investigated the two projects that won't open.  It appears the .NET 3.5 WPF Projects have a totally different header - it follows:

<Project ToolsVersion="3.5"
             DefaultTargets="Build"
             xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

The return on investment for supporting this new format (any efforts to convert it) are not worth it; particularly since I simply have to continue good programming practices and patterns for it not to be a problem; XAML projects will contain only UI code and I'll have all the supporting logic in class libraries (an example for my SDMS application is in the following image).

This does however cause a problem for me with the WPF Calculator program that I am architecting for my gap analysis.  Most, if not all, of the wiring-up logic is sitting in the DemoApplication's CalculatorHost.xaml code behind file - not good...   This is not good for reverse engineering nor does it promise to offer any reusable components (chomping at the bit for MEF to be released).  So now I'm in refactoring mode - pulling all of the code out of code-behind and placing it in an external library.  It's a painfully slow process because I have to refactor, test everything (there are no unit test), check-in and move another component and start the cycle over again....  

The ROI for all this work is that the WPF Calculator is my POC (Proof of Concept); when I'm done refactoring to get the code out of the UI I can complete the Architecture work.  My goal is to keep refactoring the WPF Calculator until it is a CompositeWPF application with reusable components that I can use in my SDMS application.   The WPF Calculator UI will have less code than my SDMS UI does below so I have no issues with manually adding these objects to Visio: 

 


Tags: , ,
Categories:


Actions: E-mail | Permalink |  Grammar/Typo/Better way? Please let me know

Visio - Classifier does not show up in dropdown list

Some of the classes are not being properly imported into Visio resulting in them not showing up in the classifier list (specifically while trying to declare a sequence diagram object LifeLine).  Numerous attempts of making copies, moving to other projects and then back failed....  The following is the workaround that I found to work:

Note in figure 1 that BuildFailedException is not available in the Visio classifier list, without it we'll be unable to add it to our sequence diagram....

 

If we create a new class with the same name we'll have two of them in our list???  Curious as to why the other one now shows up... If we go back and delete the one we just added they will both drop from the list....

The solution is to keep the new class entry and drag/drop all of it's methods and properties into the new class.  From that point on Visio will display the class so that it can be used.   Not an optimal solution but sure beats having to reenter all of the properties, methods and the method parameters.


Tags: , ,
Categories:


Actions: E-mail | Permalink |  Grammar/Typo/Better way? Please let me know

Visio - Reverse engineering with Visual Studio 2008

If you've ever had to create a sequence diagram from scratch, i.e., created all classes, interfaces, methods, etc, then you'll know it is a time consuming process and will appreciate the ability to reverse engineer existing code.  

Typically when I start a new contract the first thing I do is reverse engineer the code into a Visio document and use it as a template for diagrams I'll create (as I learn their system). Fortunately my last few contracts have had Visio and an MSDN license so I could grab the Visio for Architects application and get setup at  no client expense.

This may not be the case in the future....  I upgraded my current contract's environment to Visual Studio 2008, so that we could take advantage of the new Web, WCF and Smart Client Software Factories and was disappointed to find  that there was no way to reverse engineer the code to diagram our finished projects.  I am not alone in my disappointment (ref: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2488400&SiteID=1).

UPDATED - in the above link I provide a work-around to the problem; convert the solution and project(s) to Visual Studio 2005.

As a result my current client is in the process of purchasing the Altova UModel application - it has a reverse engineering capability for Visual Studio 2008, is reasonably priced and has a professional look and feel. 

As for me... I'm in the process of downloading Visual Studio 2005 from MSDN (my Vista development box only has VS2008) so that I can set up a new (different) development box with XP, VS2005 and Visio for Enterprise Architects.  The only purpose in life for this box will be to reverse engineer VS2005 source code into a Visio document (so I don't have to use my wife's laptop anymore;).  

Fortunately the Unity 1.1 download is a VS2005 project so I'll have no problems reverse engineering it to create diagrams as I learn how it works under the hood.  I'm dreading the work I'll have to do when it comes time to address the CompositeWPF (VS2008) diagrams - I'll manually create the objects before I'll switch....

In case you are like me and don't have the required applications on your development box I'm providing a reverse engineered Unity 1.1 Visio Document for your convenience. 

Unity1.1.vsd (514.50 kb)

 


Tags: , ,
Categories: Unity


Actions: E-mail | Permalink |  Grammar/Typo/Better way? Please let me know