Architecture, Design and Modeling Improvements in Visual Studio 2015

Introduction

In this major release by Microsoft some new features of Architecture, Design and Modelling have been improved. Using this functionalities all the design part is done. The main dependencies cycle and graph, relation among entities and other items in the project.

The problem is the extraction of the architecture and design information directly from the code and the use of that the specification of what the architecture should look like and then the validation of the code against that specification. That is a very good step taken by Microsoft in improving the architecture part.

Architecture and modeling helps the developers to understand the dependencies over the modules while the coding of it can easily explain the use, design and graphical parts. If a project is proceeding then another programmer understands the code while going through the dependency graph and designs part of the code.

Code Maps and Dependency Graph

A Code Map is used to analyze complex code written by another programmer or the programmer himself when developing a new project. 

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5. using System.Threading.Tasks;  
  6.   
  7. namespace MultipleInheritance  
  8. {  
  9.    // this is super class ..  
  10.    class SuperMost  
  11.    {  
  12.        public void method1()  
  13.        {  
  14.            Console.WriteLine("this is the method1 in super class ::acessed by object of subclass");  
  15.        }  
  16.    }  
  17.   
  18.    //this is interface.  
  19.   
  20.    interface Abc  
  21.    {  
  22.       void methodx();  
  23.    }  
  24.   
  25.    //this is derived class ..and extending class and implementing interface at a time.  
  26.   
  27.    class SubClass : SuperMost, Abc  
  28.    {  
  29.        public void method2()  
  30.        {  
  31.           Console.WriteLine("\t this is the method2 in subclass");  
  32.        }  
  33.        public void methodx()  
  34.        {  
  35.           int a = 10;  
  36.           int b = 20;  
  37.          Console.Write("sum is from interface's method :" + (a + b));  
  38.   
  39.        }    
  40.    }    
  41.    class Test  
  42.    {  
  43.       static void Main(string[] args)  
  44.       {  
  45.          SubClass sb = new SubClass();  
  46.   
  47.          sb.method1();  
  48.          sb.method2();  
  49.          sb.methodx();  
  50.          Console.ReadKey();  
  51.       }  
  52.    }  
  53. }  

 The Code Maps for the preceding code 

code map diagram

Improvements
 
  • Rebuilding of a solution can be skipped for better performance when creating and editing diagrams.

  • Create diagrams from the Class View and Object Browser

  • Filter relationships to make diagrams easier to read

It can't be longer to use Architecture Explorer to create these diagrams. But still Solution Explorer could be used for this purpose.

The following is the older version of the Architecture tab in Visual Studio 2013 just for reference.

snapshot of visual studio2013


Here is the Newer Version of the Architecture tab in Visual Studio 2015 preview.

object browser enhanced

It can be seen that the appearance has changed and Object Browser and Class View were introduced and New Code Map was also introduced. Here we can see that Architecture Explorer is no longer supported but its functionalities can be invoked using Solution Explorer. 

Layer Diagrams

In the latest release, the diagrams can be updated using the Class View and Object Browser. it is mainly used to define the structure of the system. To meet software design requirements, use layer diagrams to describe the desired dependencies for the software.

Keeping the code consistent with this design by finding code that doesn't meet these constraints and validating future code with this baseline. Note, this release omits various aspects although the complexity is still there but the efficiency of making the diagrams is increased.

UML Diagrams

Unified Modeling Language (UML) models help you to understand, discuss and design software systems. Visual Studio Ultimate provides templates for five of the most frequently used UML diagrams: activity, class, component, sequence and use case. In addition, you can create layer diagrams that help you define the structure of your system.

uml activity diagram
Figure: A rough sketch of UML activity describes an action that occurs when the user interacts with an ATM machine.

Unfortunately UML Class Diagrams are no longer created (and sequence diagrams as well) from code. But still these diagrams might be created using new UML elements.

Class Diagram 

class diagram uml

Now try to generate the code from the diagrams. Note, we are doing the reverse of the process specified above.

generated code

Here we can see that the code has been generated and two files were generated, College.cs and Student.cs, since College and Students were classes as shown above.

The following is the auto-generated code for Students.cs: 

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5.   
  6. public class Students  
  7. {  
  8.      public virtual int stuId  
  9. {  
  10.    get;  
  11.    set;  
  12. }  
  13.   
  14.    public virtual string stuName  
  15. {  
  16.    get;  
  17.   set;  
  18. }  
  19.   
  20.     public virtual int stuFee  
  21. {  
  22.     get;  
  23.     set;  
  24. }  
  25.   
  26. }  
Note that it is a compiler generated file so modification may damage the diagrams, since the same code for College.cs was generated.
 
In the preceding process, from the creation of diagrams using the UML element tab to the code generation we saw that we are doing the reverse process of that depends on the latest releases, the code diagrams can't be created but the reverse is true so in this article we are doing the reverse process.

Summary

This article just attempted to determine the features that have been omitted and improved as well. This era of programming has very complex programs being written every day so there is a need for understanding code using modelling, dependency graphs and code maps.

Up Next
    Ebook Download
    View all
    Learn
    View all