Code Metrics in Visual Studio

Out of box Visual Studio comes with facility to judge the Code quality. Below 5 metrcis can be checked in VS.
Maintainability Index,
Cyclomatic Complexity,
Depth of Inheritance,
Class Coupling, and
Lines Of Code (LOC).

Depth of Inheritance, Class Coupling are Design metrics.

In the industry more than 20 metrics exist to validate the code. LCOM4 is important of all such.

Advertisements

Set Width of Control in CodeBehind in WPF

We faced a small issue where we kept a control on WPF UI. The application was a WPF desktop application.
The width of control was required to be equal to the width of the screen. If width of UI is changed at runtime, the width of control should also increase and decrease according.
ActualWidth property solves ths problem.

How Visual Studio Understand Code written in its editor?

Ever wondered how Visual Studio come to know that a class has been created?
How Code editor understand if a function or a property or a namespace has been created?

The CodeDOM provides types that represent many common types of source code elements. You can design a program that builds a source code model using CodeDOM elements to assemble an object graph. This object graph can be rendered as source code using a CodeDOM code generator for a supported programming language. The CodeDOM can also be used to compile source code into a binary assembly.

Some common uses for the CodeDOM include:

Templated code generation: generating code for ASP.NET, XML Web services client proxies, code wizards, designers, or other code-emitting mechanisms.


Dynamic compilation: supporting code compilation in single or multiple languages.

For full article go to:
http://msdn.microsoft.com/en-us/library/y2k85ax6(v=vs.100).aspx

Best ALM Tools in Market

Time-to-market pressure is driving the application development life cycle management market to evolve and expand.
The application development life cycle management (ADLM) tool market is focused on the planning and governance activities of the software development life cycle (SDLC).

Key elements of an ADLM solution include:
Software requirements definition and management
Software change and configuration management
Software project planning, with a current focus on agile planning
Work item management
Quality management, including defect management

In addition, other key capabilities include:
Reporting
Workflow
Integration to version management
Support for wikis and collaboration
Strong facilities for integration to other ADLM tools
Survey conducted by a reknowned group, came up with this:

untitled

Clearly TFS by Microsoft is the market leader.

WPF UI Automated Unit testing

While working on a WPF application, we created the automated unit tests. Application was developed using MVVM pattern.
Using MS Test we were able to test the Model, View Model but another challenge was how to ensure the binding is correct?
We created a utility which help us test the binding, as well as check the static property of controls used on each UI.
UI and its binding are testable now and are part of Automated unit test!

TFS Build customization: Validate Code and Design Quality as you build.

Validating the quality of the code and the design of the application is as important as creating the build.

TFS 2010 and onwards, provide 2 ways to integrate 3rd party tools with build process for validating the build quality:

–>Build Activity

–>Custom build event

For first option, since the TFS build is now WWF based, build template is modified to configure parameters. These parameters work as input for validating the metrics. 3rd party tool use these parameters and generate a report that is again consumed by build process. Based on the report the final build may be passes or failed.

In custom build event method, Post Build Event of project is modified to call the 3rd party tool. If the build pass the metrics test of 3rd party tool, the final build dll are copied to a particular location, signifying the build dll has passed the metric test.