Design, Code, Release

If it was only that easy

Monday, 6 February 2012

NDepend – final thoughts

Over the last 4 posts I’ve covered the different editions of NDepend, installing and starting off, the report and Visual NDepend and wanted to just wrap up this series summarising the information and adding some of my own thoughts.

The Product

I have to say that the fact NDepend offers a free version for individual developers is brilliant, there used to be several tools in the .Net world that did this but gradually they all seem to have become commercial and only offer time limited trial versions. 

There is a small catch in that the version you download is time limited itself but there is nothing to stop you downloading the another trial edition (web page even tells you when the next free download will be available) but I can imagine this becoming a pain after a while and could lead people to looking for an alternative.

One thing that surprised me was the amount of help and documentation that is available on the NDepend website ranging from simple FAQ’s to video tutorials which will help with not only how to use NDepend but the information the NDepend provides.

The Functionality

As I mentioned in my post on the report when you first start using NDepend you are most likely to focus on the data in the report and although it contains a lot of information I still believe that the report is of most benefit in a CI situation allowing you to track the evolution of your code base.

In day to day work Visual NDepend or the visual studio AddIn is where I believe the most value is to be found for individual developers allowing them to identify the points to focus on.

Although you can use the stand alone application (Visual NDepend) in my opinion for most developers it is the visual studio integration that will provide the most value since you don’t have to leave the IDE to utilise the functionality.

The Code Query Language is what differentiates NDepend from other static analysis tools allowing you to understand how it identifies code that violates its rules as well as making it easy to customize existing or create new rules.

Configuration/Customization

The fact that NDepend provides a way for you to customise the rules that it runs against a code based is, I believe, one of its biggest strengths. You also get fair amount of configuration over how it behaves and looks.

However, there is no easy way to share this customization/configuration between projects let alone other members of the team.  For me this is probably the biggest failing of NDepend, yes you can manually alter each project and using source control if you add the ndproj file then when the next developer pulls/gets the code they will get the settings.

A couple of issues…

One issue is that you need to care about what NDepend is showing you about your code base. There is a lot of information it provides and with the amount of help on the website it is fairly easy to understand the various metrics that NDepend rules identify and use.  Even with all this information you have to care about it, for example if you have methods with a high Cyclomatic Complexity although you may understand what it means if you don’t care then the the tool is of little use.

I feel I have to mention cost, for a larger enterprise organisation the licencing cost is unlikely to be a big issue but for smaller companies & individual developers, or hobbyists, the cost of the professional edition could be just too high. 

I would also mention that I believe if you want the best results from NDepend you need everybody on your team to have it as just having it on a single machine, even if its the build machine, makes it hard to then follow up and fix violations.

Summary

As anybody who knows me will know I’m a big fan of SOLID clean code and I like to be able to use metrics to understand my code and where I may need to improve it, I find that NDepend helps me with this.

It is simple to get started with but there in lies its deceptive nature as it can not only tell you a lot about your code base but you can also learn more about various principles behind good code bases (I learnt all about the efferent & afferent coupling).

NDepend is a tool that you need to spend time with to understand what it can show you and how to get the most out of it, if you do decide to invest the time I believe it will repay you in cleaner code and increased knowledge.

Note: I was provided a copy of the professional edition to review back at the beginning of last year, this hasn’t effected what I have said about the product which hopefully you can see in this series of posts.

Friday, 3 February 2012

NDepend–Visual NDepend

The last post went over the report that NDepend generates, this post is going to focus on Visual NDepend, the stand alone program and the functionality it supports.

Interactive

The difference between the report and Visual NDepend (from now on I’ll just call it NDepend) is that you have much greater ability to drill down into the code base allowing you to jump between various graphs/diagrams, you can then right click on the item and jump to a different view with the specific item the focus of the graph/matrix.

Wednesday, 1 February 2012

NDepend – Analysis Report

In my last post I discussed installing NDepend and getting your first report out, this post is about that report.

I’m not intending to go into every single aspect of the report as it contains a huge amount of information and the report itself provides help and assistance on nearly everything that it contains by linking to resources on the NDepend website.

Note: All details discussed are in relation to the Professional edition of NDepend, it is possible you will not see all this functionality if you are only using the trial edition

The Report

As I mentioned at the end of the last post with the Visual Studio AddIn in place when you build your application NDepend will automatically kick in, analyse the code and create a report for you detailing metrics, adherence to some standard developer rules, graphs displaying further information about the code base in different formats, etc.  Your browser will be launched and the html based report will be displayed but this isn’t a simple static report as it provides the ability to drill down into various sections to look at the analysis data in more detail.

Monday, 23 January 2012

NDepend–getting started

In my last post I outlined the various editions of NDepend that were available, in this post I’m going to go through the install process and first steps with NDepend

Installing

Open up the Extension Manager in Visual Studio (Tools –> Extension Manager) and search for NDepend,  you should then see the following:

NDepend_ExtManager

Tuesday, 17 January 2012

An introduction to NDepend

If you are anything like me then you love to have information about the code you write whether its test coverage, cyclomatic complexity, or other metrics that can give you some insight into your code.

Before the shouting starts I’m not talking about metrics as KPI’s or using them for targets that developers have to meet, I’m simply talking about information you can use to better understand your code which may in turn help you to improve the code.

If you are lucky enough to have the Premium or Ultimate edition of VS2010 or VS2008 Team Suite/Developer then you get this functionality as part of visual studio, if not then you need another tool to provide you with this information. Even if you do have the native VS analysis functionality you may find that there are tools out there that provide a lot more information that the built in tools.

NDepend

NDepend is one such tool it provides metrics on your code but that isn’t all, it will allow you to delve inside the architecture of your application, allow you to diff the code, has test coverage analysis and build server integration built in. 

NDepend will also work with VS2005 upwards and as it can be used independently of Visual Studio you can actually use it even if you only have the Express editions of Visual Studio.

Disclaimer: I do not work for NDepend but I was lucky enough to be provided the software to “play with”, my opinion in this and any subsequent post is my opinion and nobody else’s.

I'm going to put together a series of posts, this being the first, on NDepend trying to give you an idea of the product and what you can, and can't, do with it.

In this post I’m going to talk about the different editions of NDepend and give some information on each of them:

Editions

Currently there are 3 editions of NDepend:
  1. Trial/Open-Source/Academic Edition
  2. Professional Developer Edition
  3. Professional Build Machine Edition

Trial/Open-Source/Academic Edition

The Trial/Open-Source/Academic Edition, referred to as Trial from this point, is a good starting place for anybody interested in trying NDepend.

As you may expect though this edition has limited functionality but to be fair to NDepend it provides the majority of features that the Professional Developer edition does so you can get a really good idea of what you can do though there are limitations imposed on the level of functionality supported for each feature.

You are able to use the trial version freely for non-commercial software but it is time limited (current downloadable version will stop working 12th March 2012) although you are able to download another version once the software has past its expiry date. The site provides guidance on using the trial version so you can decide if you really should be using it or not.

Professional Developer Edition

This is the full version that you’ll really want if you like NDepend, not only does it provide unfettered access to the majority of the functionality in the software (more on this in a bit) but also comes with additional features:
  • Test coverage import – happy to use NCover or Visual Studio Coverage
  • Reflector integration – provides an addin to reflector to allow you to jump into NDepend from a context menu entry
  • Build Comparison/Code Diff -  provides a way to diff code & builds to understand what’s changed
This edition is the one you’d most likely use day to day to check on how your code is doing and to be able to target any areas that you can see could do with some attention.

Professional Build Machine Edition

If you have a Continuous Integration server then you can enhance it with this edition that will allow you to generate reports from NDepend in your build process on the quality of the code when compared with the metrics you’ve defined.

This integration will not stop your build, it will only generate the report that you have configured.

Edition summary

Above I’ve given you a run down of some of the differences between the versions and what they do a full comparison can be found here on the NDepend site.

As I eluded to the professional version doesn’t appear to support some of the features that the trial version does namely those related to build server integration.

I can understand why this has been done as it allows people to download a single version of the software and try out both the interactive and build integration facets of the application.

It would be nice though to be able to get the Professional edition to do this functionality even if only for trial purposes, it is possible it already does this but the aforementioned comparision chart seems to indicate that it doesn't have those features.

What’s next?

The next post will probably just be a short one as I’m going to be looking at the installation of NDepend.

Tuesday, 3 January 2012

2011 into 2012

Just as I did in last years post this post is effectively a retrospective on 2011, including looking at whether I achieved what I wanted to achieve, and some goals for this year.

2011…

Goals

In my post from last year my goals were:

Saturday, 31 December 2011

A generic repository

Way back in January I said that I was going to post on a generic repository, due to various other diversions during the year I never managed to get around to completing this work but on the last day of the year it is finally all done and to tick off one of my goals here is the post about it.

What’s it all about?

When talking about both Linq to Sql (L2S) and Entity framework (EF) you will frequently hear developers saying that they will be using a repository to encapsulate the ORM interactions, what this means in practice is hiding the actual ORM functions and providing a abstract class or interface you can mock to make it easier to test your applications.