Taswar Bhatti
The synonyms of software simplicity

Disclaimer : My license for NDepend was provided for free by Patrick Smacchia at NDepend. The article below is based purely on my observations and the use of NDepend.

A Review of NDepend

I have know about NDepend since 2008-2009, but have never used a third party static analysis tool other than Visual Studio built in tools.

So lets get started and see what NDepend brings us. After downloading and installing NDepend, launching VisualNDepend.exe I got this screen. Note: NDepend is also integrated with VisualStudio, one can also launch it through the solution context.


There appear to be a big arrow in red that is animated and is calling for an action. By clicking on it I am able to navigate to a Visual Studio Solution that I wish to analyze.
Let me pick a WPF Prism Demo project I wrote last year to play around Prism.

After picking the solution I am given the option to include all the projects that I wish to analyze in the solution.

The analysis then just zips through and it opens a new html page for report on your browser.

And a window/dialog to guide us through the report in the VisualNDepend.

I have choosen to look at the dashboard from the dialog, lets see what NDepend finds for my demo project.

First thing I notice is I have 1 critical violation, if I dig deep into it I see that the name Bootstrapper is violating the rule of “Avoid having different types with same name”. All Prism applications require a bootstrapper, it is something that loads your IoC container modules. It is somewhat debatable if its a violation since it inherits from UnityBootstrapper, but I can understand why there is a conflict also, maybe one should have named it ProjectNameBootstrapper.


The next thing that I looked into is the Dependency Matrix. The dependency matrix looks a bit like an odd matrix of numbers, and each number signifies the coupling of the code.


One thing that I did find helpful is the dependency graph, it shows you how your projects are related to one another in a graph, as far as I can tell I have only scratch the surface of things, it can also dig into each method and find out what calls are made to what modules.



I have to say NDepend is a very powerful tool which allows one to write LINQ like queries called CQL, for customizing your own static code analysis. I also think that this tool is catered towards System Architects not your day to day coder, since the information that you can get using the tool is enormous. Maybe a lite version may help with day to day coder, mainly focusing on critical errors and violations, something that can even integrates into your unit test.


So today I received MVP award for 2014 :)
You can expect more from me this year on talks and blog post.

Here is a quick C# tip, when using string compare don’t use

var str = "Hello";
if(str.ToLower() === "hello")

use the Equals and StringComparison.InvariantCultureIgnoreCase enum.

var str = "Hello";
if(str.Equals("hello", StringComparison.InvariantCultureIgnoreCase))

The thing you need to note is which rules are appropriate current culture, the invariant culture, ordinal or another culture entirely.
One can create the compare from StringComparer.Create(culture, true)

Node Tools for Visual Studio is currently in Alpha 1.0 and its free and opensource, in this post I will show you how to install Node and Node Tools for Visual Studio (NTVS).



First lets install Node.js
Download Node from http://nodejs.org/

The currently version is node-v0.10.26-x64
Step one lets run the msi that we just downloaded from nodejs.org

Node Install

Node Install

Read and Accept the License Terms and Conditions and click on next.

Node Install

Node Install Screen 2

I have chosen the default location which is C:\Programs Files\nodejs

Node Install

Node Install Screen 3

Remember to install npm, Node Package Manager is the package manager for node, similar to NuGet for .NET

Node Install

Node Install Screen 4

Node Install

Node Install Screen 5

Node Install

Node Install Screen 6

Node Install

Node Install Screen 7

Finally we will verify with command prompt if node was installed properly by typing the command node -v

Node Install

Node Verification screen

Now lets install the NTVS tools for visual studio.
Download it from http://nodejstools.codeplex.com/

I have downloaded the Visual Studio 2013 version of it, it also comes with a 2012 version.
Let run the NTVS 1.0 Alpha VS 2013.msi

Read and accept the terms and condition and click install

Node Visual Studio

Node Visual Studio



Now we will lauch Visual Studio 2013 and go to the JavaScript section, one will find templates for Node.js



In my next post we will go through and write a simple node and express web application.

Software Teams

Tips on motivating your team of software developers

Build Trust
Be with the team build trust just like a coach who motivates a team for a game, keep them motivated before and during and after the game, even for the next game. Keep them engaged have food/lunch with them (there is something about breaking bread together), bring them pizza during crunch time.

Realistic goals and targets
Get the input and agreement with the team, for work the team has to do, don’t just assign the work to the team/person and mark it (2 week project) when the team/person who is involved in doing the job does not even know about the work/task that needs to be done. Have them involved during the scoping of the project since they will have insights to the project or code base that as a lead or manager did not think about.

Measure performance
Are we on track or off track, how do we measure (Agile, Scrum/Kanban board, Story Board), what resources my team members need to get back on track. Maybe there needs help in some area expertise, support and tools

Celebrate success and incentives
Even for small milestones, not just at the end, rewarding the team all together not just the super man hero attitude. A Starbucks or TimHorton card for everyone goes a long way, also buy nick knacks for a reward. Let people know that they are awesome for what they do.

Know your team
Is the person a detail oriented person, are they right for the job that you have assign them Find out if they are introvert or extrovert, what are their idiosyncrasy, being aware of where they are on the project, be mindful treat people with respect. During a marathon, runners get water at certain spots, being the manager you need to be the person who is handing out the water and cheering for them, so that your team is motivated and hydrated to keep them running, same goes for software development.

Meet regularly
Have small/daily meetings with the team to find out if there are any road blocks and additional resources that is required. Have monthly meetings with individuals one-on-one to talk to about: future projects, how as a manager you can improve (reviews goes both ways), a form of retrospective on things that one can do well, get inputs from individuals sometimes people may not like to speak in a crowd, having 1-1 input is great for even performance review, take notes, rather than leaving it for end of year one should do it every month.

Its not about you, give them a purpose
Its about the team now, as a manager you need to know what motivates your team. Is it money? Is it work life balance? comfortable environment? working remotely? Every one is different and is motivated differently, find out what makes the developer “ticks” and unlock the potential of the developer. Allow them to create a purpose to what they are building find ways to show values of what they do and not something nonsense that they are building.

Share work with Autonomy
There is something called the “bus factor” for a reason. If developer A is the only person who knows the database code and no one else does, what happens if tomorrow s/he gets hit by the bus? Utilize your team to know all the skills of the system, have people work on a project together to motivate each other, be confident in their ability, let them have the autonomy of making decisions on modules.

Be positive
No one wants to work for a negative workplace/person. Show your excitement on the business or project you are completing. Being positive is infectious, it will lift the spirit of others and grows like a snowball.

Square Brackets

Here is a quick tip, when you are searching for a text that contains square brackets “[]” in Microsoft SQL Server. For example you are searching for a text that contains “text text text [text] text text”. A simple query using LIKE % would not do the trick.
One has to add double square brackets to search for the square bracket text.


Select * from Employee where Status like '[Part-Time]'

The previous query will not return any match items. But if you replace the query with double brackets like

Select * from Employee where Status like '[[Part-Time]'
Select * from Employee where Status like '[[]Part-Time]'

The above will return you data that match the square bracket text.

team work

Here are 4 tips on Hiring for startups

1) Hire well rounded senior developers.

If you hire junior developers you will end up having a lot of code debt and at the end you will
have to pay back the debt (just like borrowing money with interest). Having well rounded generalist senior developers would alleviate most of the debt but also have a small number of juniors to help out small modules. I have seen companies with 4 seniors do amazing things.

Of course, the initial cost of hiring senior developers is way more than juniors but at the end it will cost you less, since you will have less technical debt.

Also try not to hire specialist. e.g database scaling pro (DBA), web scaling pro, since you need someone who can jump into any part of the code to fix things (database, network, web, font-end javascript, version control etc), while a specialist may not have that experience.

2) Give Incentive to employees

Early stage startup need to give incentive’s to all the founders. Give equity to the people who work, but do give them by fairness and by giving it in equal portions to their input to the company. By giving them shares or equity, you would create more loyalty from the employees, they would put their heart and soul into the baby (startup).

Don’t forget to create a vesting schedule, overtime give share to the founders they are allocated. e.g first year 30% and over the months the rest of the amount of it, thus it will eliminate if a founder leaves the company of having 50% of the share in the 10th year of the company when they left in the first year.


  • Founders: 25% up front and the rest monthly over 3-4 years.
  • Employees: 25% after one year and the rest monthly over 3-4 years.

3) Dont’ forget remote talent

It may be hard to hire local talent but remote work is getting very popular. I don’t mean outsourcing by just hiring people from China or India to do the work, maybe the talent is not in your city, maybe in another part of your country, and the developer is willing to work remotely and time to time travel to the startup location to have meetings etc.
I believe this is gaining quite a momentum these days e.g #37signals, #github, etc | https://weworkremotely.com/

4) Always be hiring ABH

In the words of Glengarry Glen Ross speech ABC (Always be closing). A startup needs ABH (Always be Hiring). A startup needs to be always be hiring and looking for great talent, because you may be happy with your team but you never know if someone else would scout your talent away from you.

Here is another C# tip.
Most of the time when you are trying to get a value from dictionary you would try to check if the key exist or not something like.

  var value - dictionary[key];
 //do some stuff

But one can use TryGetValue

if(dictionary.TryGetValue(key, out value))
  //do stuff with value

The benefit of using TryGetValue is that the dictionary is synchronized, there is no race condition.

Here is a hint when using WPF and you may come into a situation where you want to databind an element to its Parent ViewModel.


As an example lets say you have a view that is binding to ViewModel and inside your xaml you have a control that has DataTemplate
Below we are using the BusyIndicator from https://wpftoolkit.codeplex.com/

                 <StackPanel Margin="4">
                          <TextBlock Text="{Binding MyProcessText}" FontWeight="Bold" HorizontalAlignment="Center"/>

Our ViewModel looks like

public class ViewModel
  private string _text;
  public string MyProcessText { 
   get {return _text; }
   set { _text = value; RaisePropertyChanged("MyProcessText"); }

We would assume that the property would bind, but actually it doesn’t since the datatemplate is there.

So what we need to do is bind it to its parent viewmodel

What we need to provide is RelativeSource and the AncestorType, below we are using UserControl but it could also be Window or a provided type like AncestorType={x:Type XYZObject}

<TextBlock Text="{Binding MyProcessText, RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}" FontWeight="Bold" HorizontalAlignment="Center"/>

If you are running Windows Server 2012 with IIS8 and you got this error HTTP Error 500.19 – Internal Server Error. If you web.config file contains “handler” or “modules” tag.

In order to fix this, launch cmd or powershell and execute these 2 commands inside of C:\Windows\System32\InetSrv

PS C:\Windows\System32\InetSrv> .\appcmd.exe unlock config -section:system.webServer/handlers

PS C:\Windows\System32\InetSrv> .\appcmd unlock config -section:system.webServer/modules

This will unlock the handlers and modules section.