Alternate Image in Diagrams
For communication with higher level audience you can change default images in the VSTA 2010 diagrams.
VSTA Layer Diagram and MEF– Does my Design Smell?
Did some playing with MEF and a Smelling Layer Diagram today… it turned out to be an interesting scenario.
There are many anti-patterns, patterns which have been proven not to work well. Anti-patterns for buildings, for collaboration, for businesses, for code and for sure for design. Some are common, like cyclomatic dependencies between components, some are more specific for a company and even every designer has some anti-patterns made for himself. Every designer, application architect or anybody else involved in designing something knows them or should know them to make a better design and finally application. So, it would be interesting to get a notification when your design SMELLS according to those generic or specific Anti-Patterns, these kind of notifications would help the design, application, business, developers, testers, operations and even better would help the learning curve for new designers/ architects.
The problem, there are to many anti-patterns as a designer you want to pick your own selection or even make your own anti-pattern notification mechanism, giving notifications, warnings at design time not at build time but at design time so you can evolve your design to a really good one.
Now MEF comes insight, actually it came insight by me this morning on the metro to the office [have to go by public transportation since I did my car away last month]. During the ride I watched a webcast about MEF and decided… that’s really cool for this Anti-Pattern scenario. Great an Add-in based on MEF which validates, analyses your design according to several Anti-Patterns and with MEF in place people can add them at will.
The User Story
I created an Add-in, see image “LayerDiagramSmell”
This Add-in has adds a Menu-Item “does my design smell..?” to the diagram [in my scenario the Layer Diagram]
When you execute this command it checks your design at several Anti-Patterns… and shows his findings in the design. I only change the name in this implementation, but it’s very easy to change colors of lines, shapes and give notifications in the “Error List” [it’s just a pilot].
Now the designer/ architect can think, maybe I have to change this implementation….
I already explained the making of Add-in’s for diagrams in a previous post and MEF is really easy, here is some code…
1. add a reference to System.ComponentModel.Composition.
2. get the Smells binairies
var catalog = new AggregatingComposablePartCatalog();
var container = new CompositionContainer(catalog.CreateResolver());
3. Create the Smell Classes.
Smell1 and Smell2 put there DLL’s in the “C:\temp\smells” directory which are loaded in the container and are executed [used for analyzing the diagram].I created them in the same solution but anyone who makes a class which implements the SmellInterface and puts the assembly in the Smells directory has his own Anti-Patterns analyzer.
4. implement some logic for analyzing the diagram, this is Smell2 and a really really basic implementation [It should be better for me not to post this kind of code, anyway… it works ]
public class GetSmell : ISmell
public List<Layer> DoesThisSmell(LayerModel layerModel)
List<Layer> LayersThatSmell = new List<Layer>();
foreach (Layer item in layerModel.Layers)
foreach (var dependencyFrom in item.DependencyFromLayers)
5. And finally put the Anti-Pattern information back on the diagram.
List<Layer> LayersThatSmells = ModelElementsSmell.DoesThisSmell(loadedModel);
using (Transaction t = loadedModel.Store.TransactionManager.BeginTransaction("anaylis diagram"))
foreach (var item in LayersThatSmells)
item.Name = "THIS STINKS" + item.Name;
SerializationResult result = new SerializationResult();
LayerDesignerSerializationHelper.Instance.SaveModelAndDiagram(result, loadedModel, _applicationObject.ActiveDocument.FullName, diagram, _applicationObject.ActiveDocument.FullName + ".DIAGRAM");
I know not enough information to reproduce this example, but I'm curious what you think of this scenario and for sure what are your Anti-Patterns…
More on this in the future….
Visual Studio 2010 [formerly known as Rosario] Video’s
A lot of video’s on Channel 9 about VS2010 and a nice thing… they us the newest bits for it. So, watching them give a nice insight in where Rosario is going.
Architecture Day (Tuesday, September 30th):
- Cameron Skinner: Visual Studio Team System 2010 – Architecture
- "Top-down" design with Visual Studio Team System 2010
This one is really nice, Mark guides the viewer to the creation of the demo project ‘DinnerNow’ with the us of the UML diagrams. As you can see there is a new Model Explorer [upper left corner] and what you don’t see there is also a model project type added to Visual Studio… and a lot more new things.
Drag and Drop from the model explorer..! and a lot more connections between the diagrams.
Two months ago I made a video demo how we are using Team Architect UML for a real live project [for internal use]. I just uploaded it to YouTube, so you can see the difference between a demo project [Dinnernow] and a real life project… not that much difference :-)
- "Bottom-up" Design with Visual Studio Team System 2010 Architect
A nice new feature in the sequence diagram…
and an example of the layered diagram
with validation enabled in the build process…
The last one about Team Architect: ARCast.TV - Peter Provost on what’s coming for Architects in Visual Studio Team System
The other video’s about VSTS2010 below [haven’t watched everything yet, still busy with my vacation photo’s]
Business Alignment (Wednesday, October 1st):
- Achieving Business Alignment with Visual Studio Team System 2010
- Agile Planning Templates in Visual Studio Team System 2010
- Enterprise Project Management with Visual Studio Team System 2010
- Requirements Management and Traceability with Visual Studio Team System 2010
Software Quality (Thursday, October 2nd):
- Better Software Quality with Visual Studio Team System 2010
- Manual Testing with Visual Studio Team System 2010
- Historical Debugger and Test Impact Analysis in Visual Studio Team System 2010
Team Foundation Server (Friday, October 3rd):
- Brian Harry: Team Foundation Server 2010
- Branching and Merging Visualization with Team Foundation Server 2010
- Enterprise Team Foundation Server Management with Mario Rodriguez
- Team Foundation Server 2010 Setup and Administration
- An early look at Team Foundation Build 2010 with Jim Lamb
- A first look at Visual Studio Team System Web Access 2010
- Update on Team Foundation Server Migration and Synchronization
How Do I: Model Class Libraries using the Architecture Edition Power Tools?
Another video on MSDN about Team Architect from Richard Hundhausen... this time the video covers the Architecture Edition Power Toys.
three comments on the video:
- Hurray we get support for class libraries [00:00:34]. I'm not a big fan of having class libraries on the application diagram. when you make a serious project, you get a lot of shapes which don't add any value to the diagram [see image, also testprojects will show up in the diagram] and class libraries don't belong at application level [see Bill Gibson's post about this, TN_1105- Why Class Libraries are not shown on an Application Diagram]
- Synchronize back and forward with the solutions, just as every DSL should do... [00:01:04]. I disagree, not every DSL should do this, in most situations you really don't want this. When the differences in abstractions between the two languages is very low, it's an option in other situations I won't recommend synchronization.
- The rest of the demo: I really like... but, due to comment #1 I'm not using the powertoys.
Rosario - Create Sequence Diagram from Existing Code
Located on beautiful Orcas Island in Washington State's San Juan Islands, Rosario Resort & Spa has long been a favorite destination for travelers seeking relaxation and unparalleled beauty in the Pacific Northwest.
Anyway, lets look at some other kind of "relaxation and unparalleled beauty", create Sequence Diagram from Existing Code.
The scenario this feature supports is the same as the physical class diagram and the Architectural Explorer, help people understand and evaluating a implementation / architecture of existing code by visualizing it.
The dependency matrix visualizes dependencies between artifacts, the physical class diagram visualizes the static relations between objects and a sequence diagram visualizes its dynamic behavior.
How does it work?
The Architecture Explorer has set of commands, with one of it "Insert into Active Diagram". This command creates a sequence diagram from the method you have selected [see image]. Nice thing to know, this set of commands is extensible..! more on that in the future.
After adding an empty sequence diagram and selecting the command, it creates indeed the sequence diagram [image below]. I used the "drag and drop" front-end implementation, the same one I used for the dependency matrix post and the code metrics post.
This diagram doesn't show return types and parameters. For example the Lookup method look like this in code:
employee = employees.Lookup(txtFirstName.Text, txtLastName.Text);
Not that exciting, but it would help in understanding the code. Something like this...
[Always wanted to do this, use my tablet to sketch UML diagrams. Probably the last time... took me half an hour to draw this]
Another process to get there...
The physical class diagram [one to one representation of the code, see image below] has a new menuitem "Add to Logical Class Diagram...".
When putting all the necessary classes on the Logical Class Diagram. You can create a LifeLine for it... see menuitem "Create Lifeline..."
From there we can draw the interaction between those classes... and now we've got access to the operations in the classes [see dialog].
You can see that there are connected to the logical class diagram by the little "shortcut" icon on the classes.
What actually would be an interesting scenario... generate sequence diagram, generate physical class diagram, add these classes to the logical class diagram... and let these two logical diagrams work together.
More to come...
Anyway, this "drag and drop" implementation isn't that suitable to demonstrate the capabilities of the "generate sequence diagram" feature... So, next post the more sophisticated implementations... for now, looks good and time to get prepared for Vicky's birthday and Queensday ...
UML, the Most Wanted Feature in Team Architect...
One of the problems I have found in VSTS 2005 is the lack of modeling tools for the Software Architect.
[Modeling and Tools Forum, UML/Modeling Tools you are using? Replies: 20 ]
I am in a looot of problem..I want to make sequence diagram from an existing C# code..
[Modeling and Tools Forum, how to create sequence diagram from c#, Replies: 15]
First, I agree with your observation, Tad, about the lack of support for the Software Architect in VSTS 2005. We did indeed focus on the System Architect not the Software Architect. We had limited resources to allocate to architecture tools, and felt it was more important to support Microsoft’s drive toward connected systems for the 2005 release.
[Jack Greenfield's Blog]
Those quotes aren't a overwhelming proof that this is the most wanted feature set. But, you know everybody wants it.
The current Rosario CTP release of Team Architect [download] supports UML diagrams..!
I attended the Rosario Architecture Edition preview yesterday. Frankly, I'm two orders of magnitude more excited about this than I am about anything else I've seen here at the summit yet.
[Rosario rocks (Architecture edition).]
In the 2005 release there already was the ability to use class diagrams. These are tightly coupled to source files and provide roundtripping. Useful, but not for UML sketching. There is added a Logical Class Diagram to Team Architect which provides the ability to make your design and "upgrade" classes to the physical layer.
Also a capability of the Logical Class Diagram is to create lifelines for those classes in a sequence diagram. Sequence Diagrams where already added in the November CTP release of Rosario. In that release there was the ability to draw the sequence between distributed applications from the application diagram, that feature didn't make it in this release [probably I'm going to write something about that later on...].
As you can create lifelines from the logical class diagram you can create classes from lifelines.
Other diagrams currently supported by Team Architect:
Use Case Diagram
And the Activity Diagram
What everybody immediately thinks, although I did...
One, this UML tooling isn't that mature then other UML tooling already ages available and evolved overtime. What is the added value? in my opinion the real added value is TFS, create workitems, track down [or up] design artifacts to requirements or code and for sure "Enable ALM by Automation". With these diagrams we can stitch everything together. For example, we already managed to generate test cases from activity diagrams and import them into Camano. [Rob is going to blog about that soon and I wrote something about that a few weeks ago].
All the diagrams are based on the DSL tools, so customization is easy and with the designer bus [backplane] underneath all the diagrams collaboration between them is guaranted.
Two, what happened with the distributed designers? they are still there... but I haven't noticed any further development on them. So, are they still useful? yes, I think... not sure, but I wrote last week something about OSLO / DSI and how to get prepared, use those diagrams to get prepared! probably something will end up in some kind of Oslo tooling (together with the service factory).
Three, do the functional designers have to use Visual Studio, they won't do that? hopefully there will be something available like Camano, the standalone testtool for testers [also in the April release]. Should be possible with the Visual Studio Shell.
Four, What about Domain Specific Languages and Software Factories? That is a hard one, lets say for now [I'll get back on this topic later on...] all the UML diagrams are "Logical" so they are for: Sketching, White boarding, Documentation, Conceptual drawings that do not directly relate to code... [see,Team System Modeling Strategy and FAQ, What About UML?].
Still enough questions, first lets start playing with it and till now... great job [I didn't know you can great these kind of functionality with the DSL tools]!
< more to come >
UPGRADE, I forgot to mention... you can create sequence diagrams from excising code [I already posted that at the forum ]