C l e m e n s

Recent posts

Tags

Categories

Navigation

Pages

Archive

Blogroll

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    VS2010 Architecture Explorer Analyzers

    DGML, the new VS2010 visualization technology has capabilities to render graphs. Graphs like dependencies between classes, inheritance graphs, custom graph, you actually can visualize any relation you want. Cameron Skinner has posts about DGML and Chris Lovett has some great video’s.

    4 
    [class dependencies uml2doc.codeplex.com]

    Now the interesting thing is that you can analyze these graphs. In the image below you see the analyzers; Circular ReferencesHubUnreferenced.
    The purple classes are unreferenced which probably means dead code or entry point of the application. The kind of blue-green nodes are hub, classes which are important and heavy used, and no strongly connected classes in this solution.

    5

    Make your own analyzer.

    You also can make your own analyzer. For example code coverage or naming conventions or … whatever you can imaging. In the example below I created an analyzer which marks the nodes green with the string ‘Clemens’… (code you know is great:)

    1

     

    Ok, maybe not that interesting analyzer, more interesting is the creation… in the /PrivateAssemblies/Providers folder there are already several analyzers available, actually the ones mentioned above.

    6 

    A small analyze of this assembly tells us that all the analyzers are using the IProvider interface and the ProviderAttribute [see below]. After some more exploration you will find that the prgroesion.common assembly has a method ‘ProviderDiscovery’ which looks for classes in the provider directory.

    Capture 

    so, making a assembly with the code below is a good start:

    [Provider(Name = "ClemensAnalyzer")]
    public class TestAnalyzer : IProvider

    In the void Initialize(IServiceProvider serviceProvider); you have to initialize your provider, register the actions and action handler [action.ActionHandlers.Add(new ActionHandler(this.OnAnalyzeTests));]… which calls your analysis…

    foreach (Node node in this._graph.VisibleNodes)
        {
           if (node.Label.Contains("Clemens"))
               {
                      node[HasClemens] = true;
                      outputObjects.Add(node);
                      this.ThrowIfCancelled();
               }
        }

    the node[HasClemens] = true; is some additional meta data you add to your diagram: private static GraphProperty HasClemens = GraphProperty.Register("HasClemens", typeof(bool), new GraphMetadata("Clemens","This one contains Clemens",null,GraphMetadataFlags.Default), typeof(TestAnalyzer));

    All this and a bit more [didn’t finished the analysis completely, there is a lot more possible] result in your own analyzer…

    Picture1

    Now, let’s start making a useful one :-)

    Traceability in VS2010

    Always an interesting question, how does traceability work in VS2010?
    To often asked without any context, or only asked from a requirements perspective. Still way too open to answer in a tweet. So, a post to canalize those questions a little bit more…

    [see the image below for the numbers]
    1_2 you can take two directions when talking about traceability. The first is focused on “work”, the work items repository part of TFS [on the left side of the green dotted line]. with work related traceability we can answer questions like “did we completed all tasks for that requirement?” [for more see the red list]. Information which is very important for every roll in the Application Lifecycle. A tester want to know if he can start testing, so he want to see if the developer is ready. A project manager wants to plan the work. Developers want to know if designers are ready to start with a stabile set of needs… and many more. All work related information, and information which can be tracked/ traced by using work item and its repository.

     trace

    2_2 VS2010 main capability for work related traceability are the TFS work item repository [see image below from MSDN] and linking of work items, setting up a hierarchy. 

    Dd286718WIT_TaskOverview(en-us,VS100)       Dd293542TreeListScenario(en-us,VS100)

    We can breakdown requirements, or user stories, in tasks. 4_2 tasks that needs to be executed to get the requirement done. These tasks can have a parent-child relation [and other see Working with Link Types on MSDN]. Giving us the information we need in any kind of way, for example reports.

    us

    So far the work related traceability. The other kind of traceability 1_2 is based on artifacts, things we make during the application lifecycle, I will call them ALM artifacts. ALM artifacts are used to create the solution/ application. For example the source, XAML and configuration files which make the solution. But, also the diagrams which we created to make a correct, consistent and good communicated application architecture, we use them to drill down from the needs to code. And also test cases belong to the things we make during the application lifecycle [I can imaging when you get confused now, test cases are within VS2010 work item types, but they definitely belong to the artifacts section].

    3_2 Use case – user story what is the difference… I often use both [see this piece of MSDN documentation for modeling requirements]. User stories are work item types and use cases are ALM artifacts. So, they are a great bridge between the ‘work-world’ and ‘artifact-world’. The good thing is the capability of VS2010 to link diagrams, and other model elements to work items. [How to: Link Work Items to Model Elements], this give us the capability to create a trace.

    domainFrom the description and diagrams of the requirements, the often called problem domain, we have to make a big jump into the solution domain.8 Diagrams are created like the component diagram and layer diagrams visualizing the high level pieces of the solution with the dependency and interfaces between these components and layers. [used this image in this post; the modeling world].

    It is also a big gap for traceability, to get this a little bit better a solution can be the replaying of scenarios written down in the user stories and drawn in activities as described in this post; VS2010 Modeling; Create Lifeline from Component.

    A trace back from component/layer to requirement can be a link from model element to the user story work items in where he is used. Never did this, it’s a manual process and probably people will forget the links, maybe with some kind of notification this would be valuable…

    6 An interesting VS2010 capability is the connection between the layer diagram and the sources. This makes a trace possible between the high level design and the sources. See image below.

    layer val

    7 Because test cases are work item types in VS2010 they can be connected to any other ALM artifact, giving us the possibility to connect for example test cases to use case diagrams. Easier to accomplish and to maintain is the connection with test tasks and corresponding user story. But this doesn’t answers questions like; “which code is touched by this test”. VS2010 answers this question with Test Impact, see “Determining Which Builds Have Bug Fixes, New Features, or Requirements”, “Recommending Tests to Run That are Affected by Code Changes” and “Developing Tests from a Model”.

    Another interesting traceability scenario can be build with test case generation, see this ‘old’ Model Based Testing beta 1 video. [some more info on MBT can be read on Rob’s blog]

    Next, 3_25786 all have a work related task. So, not only traceability within the two sections is possible also traceability between the two sections is possible. answering questions like; “which task created this line of code?”… creating this link / trace is a manual task but it can be controlled by a check-in policy.

    workitem

    So, when someone asks you the question; “what about traceability in VS2010?” you now can canalize this and guide him/ her to the real traceability question they want to have answered [and tell the solution]….

    < probably more to come on this interesting topic, also because the extensibility model of the diagrams is powerful enough to create your own required traceability between artifacts with notifications and work item linking… very very interesting >

    VS2010 Modeling; Create Lifeline from Component

    From the VS2010 MSDN sequence diagram documentation

    Relationship to other diagrams

    You can use UML sequence diagrams together with other diagrams in several ways.

    Lifelines and types

    The lifelines you draw in a sequence diagram can represent typical instances of the components or classes in your system. You can create lifelines from types, and types from lifelines, and show the types on UML class diagrams and UML component diagrams. For more information, see Classes and Lifelines.

    Beside we can create lifelines from/for classes we also can create lifelines for/from components… which is actually a very interesting feature.

    Context menu on a component shows the create lifeline option [not available when clicking on a part ]
    cl

    After the creation of several lifelines, you can draw the interactions between the components. There isn’t functionality like the bi-directional method creation in the class-sequence diagram interaction for the component-sequence diagram. Kind of logic, a component only has interfaces.

    sq

    Why would you want to do this, create sequence diagrams for components?
    While the component diagram 3_2 is a static view of your system the sequence diagram is dynamic, it visualizes the flow in your application, the sequence of actions that occur in the system. So, you could use sequence diagrams to validate your system, your component design. Take a scenario, a requirement scenario, and create a sequence of actions from in a  sequence diagram 4_2 . By doing this you create a kind of simulated behavior of the component structure, which you can check on correctness and consistency.

    The scenarios used for this can be found in the use case diagrams 1_2 , which describe the actions that take place on/in the system. Now describes a use case diagram not really a scenario, you better can use an activity diagram for that 2_2, which can be based on the use case diagram as a kind of use case realization. Now the interesting thing is, testers use activity diagrams to create test cases, they have specific technologies to extract the right amount and type of scenarios [see http://robkuijt.nl/index.php?entry=entry080423-135750 ], these scenarios we can use to validate our component design which actually closes the loop.

    all

    It would be even more interesting and powerful if we not only could link sequence and component diagrams but also use case and activity diagrams making notification when an activity changes and a scenario can’t be run anymore on the purposed component… hard to accomplish, but interesting, versioning would be hard…

    VS2010 Sharing Models and Diagrams

    What is the use of models when you can’t share them. In a previous post  [Copy-Past Modeling Diagrams and Modeling Elements within VSTS 2010] I already talked about the copy past capabilities of the models within team architect. Now beta 2 is out, I have to say VS 2010 Ultimate. So, it is possible to copy past elements and save them XPS-files..

    But, what if you are the only one in the team with an Ultimate edition…  
    Lucky team-members, they still can open en view. See the [viewer] and believe me this is VS 2010 Premium.

    Picture1

    A nice thing they can re-organize them. See the * and save it, opening this model in the ultimate edition will show the changes.

    Picture2

    Beside the UML diagram’s also DGML and the layer diagram got this behavior.

    How to keep you fingers on the keyboard within VSTS 2010 Architecture Edition

    Keyboard junkies have a hard time with all that dragging and dropping of shapes and connectors around within VSTS 2010. So here are some tips for these junkies how to keep you fingers on the keyboard.

    New default DSL Tools behavior…

    Adding shapes to the design surface allows you to directly start typing, for example after adding a class shape to the design surface lets you start typing the class name. Hitting 'Enter’ will confirm the value and F2 lets you edit it again.

    class edit

    More interesting, in the compartments of the class shape hitting Enter twice adds an attribute or operation.  So, type a name for an attribute, hit Enter to confirm the value and hit Enter again for adding a new attribute.
    Very simple and also very quick for the creation of classes.

    class opt edit

    Fast diagram editing with shortcuts… 

    With the default behavior you still have to drag and drop class shapes on the design surface. To eliminated this piece of mouse handling you can create your own keyboard shortcuts. Cameron pointed me to this environment settings in Options dialog screen. The architecture team has created a very nice an clean overview of all the actions you can execute in this dialog. So, adding your own shortcut keys is very easy. Below I added the shortcut key “Alt-C” in the context of the Logical Class Diagram for adding Class shapes to my design surface.add class keyboard

    I also added the shortcut keys for adding Attributes and operations, just because setting the focus to the compartments isn’t that easy with shortcuts…

    And when this is still to hard for you, you can buy a drawing tablet.. with a nice tablet overlay.

    Tablet_OVerlay_3

    and you will look as happy as this guy…

    untitled

    although it just looks like he isn’t that comfortable with it…

    Copy-Past Modeling Diagrams and Modeling Elements within VSTS 2010

    This is completely new for me… CTRL-A // CTRL-C

    1

    ALT-TAB // CTRL-V

    2

    It also works in other applications, even Outlook. This kind of functionality [copy past between models] was already written down in the DSL Tools Book [page 437].

    Copy past between models is also possible, but than you have to look very careful what and how you do it. For example copy past within the same model create a model element with the same name with a number at the end.

    3

    It’s interesting to look at the Model Explorer, also in that one there are shapes added with the same name.
    Now, copy pasting from one diagram to another diagram has the same behavior, modelelements are created with a number. [the number is added because they also get shown in the model explorer, two shapes with the same name isn’t possible]

    4

    If you want these shapes to be the same, and not a copy, you need to drag and drop the shape from the model explorer on design surface of the new diagram.

    5

    The benefit of this is that now these model shapes are connected, changing the name of one [on the diagrams or the model explorer ] will automatically synchronize the other elements.

    Another thing to pay attention to is the copy-past behavior between different model projects…. actually you can see it immediately when pasting in the diagram of the other modeling project, no number added. So you could think that the behavior is the same as drag and drop  from the model explorer. But that isn’t the case, while adding an other modeling project also a new root is created in the model explorer. So, those two model elements are two different things. Drag and drop isn’t possible between model projects.

    6

    If you do want to re-use mode elements in a different modeling project, you can us the copy past functionality, which works really nice. But, you also can copy past the content of the modeldefinition file to the other project. Don’t think that is the way to go… but it works, it also reminds the relationships between the elements. You could create a default package every project needs to us…

    Soma on Architecture Tools…

    Nice overview post on the Architecture Tools by Somarsegar. He uses some new bits for the images of the diagrams.

    y1pOvtjHPmcumaRA19YyvZNqNMPEGS3pYwfHuGvpDSmLZD0qqaJMpSF-VGysgRU-WIfWuR45LcB29n3I0V8bNJxAg[1] 
    The layer diagram has two more menu item groupings [I like the custom items] and strange numbers in the shapes, curious what that is.

    Finally we have a nice overview how the Petshop application works :-)

    MSDN VSTS2010 doc’s - Modeling User Requirements

    Have been reading all the MSDN documentation about VSTS2010 last few days and I’m amazed by the quality of this. So if you don’t have the bits installed, just take a look at MSDN to get a deep dive in the new functionalities of VSTS2010.

    This is a screenshot from the Team Architect doc’s about “Modeling User Requirements“…

    Capture 

    and when you do have the bits installed, hit F1 sometimes… [I often forget that functionality]

    Swarm Theory and Architecture Explorer

    just for fun…

    This is an architecture diagram from the TeamArchitect.Modelstore.Interfaces… impressive vsts2010 can render such a diagram. But, also useless for analyzing, although….  

    missing scrollbar

    It looks like a swarm and there are some theories how these swarms behave… for example this article “The Genius of Swarms” or wiki’s explanation of the swarm theory

    Swarm intelligence (SI) is a type of artificial intelligence based on the collective behavior of decentralized, self-organized systems.

    So, the TeamArchitect.Modelstore.Interfaces has some kind of intelligence, a collective behavior.

    swarmpatter

    The Swarm Theory is also connected with Chaos Theory and that one with The Lorenz attractor, which give us some formulas for the behavior of this assembly… :-)

    anyway… I think it’s easier to put some more filters on the architecture diagram.