Friday, December 27, 2013

NDepend: Set of Rules to Show how Code Quality Was Improved

As it was mentioned in the previous article it's interesting to know how the code quality has been improved. NDepend includes only queries for quality regressions, this article contains CQLinq queries for quality improvements.

Thursday, December 26, 2013

NDepend: Code Quality Regressions and Ensure Quality from Now!

In the previous article I have described basic features of NDepend. This one is dedicated to Code Quality Regressions and Ensure Quality from Now. In a few words, you can set a project baseline and compare different analysis results, it can show how the code quality was changed during specified period of time.

Setting baseline for comparison

The settings are accessible from menu NDEPEND => NDepend Project => Edit Project Properties => Analysis tab. There are two baseline options: one for comaring in Visual Studio UI, another one for reporting. You can compare with previous analysis of the current project or with different NDepend Project you have performed analysis on. In the selected project you can also choose a specific analysis to compare with.

Wednesday, December 25, 2013

NDepend: Static Analyzer, Metrics and Dependencies

When we get a new existing project for analyzing, development or support, we often have a question: where to start from? There might be a lot of legacy code, assemblies, projects, solutions, etc. There's something that can help us to get a clue: NDepend - a tool for managing complex .NET code.


NDepend can be downloaded from the official site The response email contains installation and licence activation details and other necessary info to start.

The installation package consists of:

  1. NDepend Console - console application to run NDepend commands.
  2. Visual Studio Plugin installator. NDepend 4.1 supports Visual Studio 2008, 2010 and 2012.
  3. NDepend Power Tools with the source code. This is a set of short programs based on NDepend API, demonstrating its syntax and capabilities.
  4. Visual NDepend. This is a standalone Windows application that allows NDepend analysis outside of Visual Studio.
  5. Links to build process resources. It contains information about how to integrate NDepend to countinuous integration systems and build systems. It can be integrated to CruiseControl.NET, FinalBuilder, TeamCity and Team Foundation Server. It supports NAnt and MSBuild tasks.

Tuesday, June 11, 2013

LINQ: Func<T> vs. Expression<Func<T>>

Continuing the previous post about differences between IEnumerable<T> and IQueryable<T> I would like to describe differences between Func<T> and Expression<Func<T>>, basic features of lambda expressions and expression trees and possible impact on Entity Framework.

What is Func<T>

Func<T> is just a predefined generic delegate which encapsulates a method that accepts no parameters and returns a value of type T. It's declared like:

public delegate T Func<out T>();

Its value can be assigned to a named method or to an anonymous method through delegate syntax or through lambda expression syntax. All the following assignments are correct and return the same result:

Saturday, April 13, 2013

Entity Framework: IQueryable vs. IEnumerable

Many of us sometimes get confused of different aspects of using IEnumerable<T> and IQueryable<T> in Entity Framework. One of considered opinions is that Entity Framework and DbContext and deffered execution just do all the magic and there is no difference. But even though LINQ query result remains basically the same, it may significantly impact the query performance.

Code sample

I'm going to create a simplified database consisting of one table with million records with Entity Framework Code First.

Thursday, March 14, 2013

Animated Anchor and Button with CSS3


HTML5 and CSS3 features give us great opportunity to create rich animated user interfaces comparable with desktop versions. Here I will explain how to create rich UI button with custom HTML content and CSS3 tools only, without using javascript and images.

I am not going to explain details of an appropriate CSS3 style, but a live demo will be attached to every step, so you will be able to see how it affects different browsers.


Let's specify a general .button class, with some default styles. The class will be suitable for different kinds of tags to make them look like rich UI button.