NDepend Use Case - Find Childless Interfaces (TDD Helper)

Written by Brett Veenstra

When using TDD, especially with utilities such as StuctureMap’s RhinoAutoMocker I tend to end up with some “childless” interfaces.

Granted, this could just mean I’m a crappy OO designer, but I like to think it’s more from hammering out the design as I’m working on the problem!

So, I might have a code base that has unused interfaces lying around, and I just want to clean those up.

With NDepend, you can use Code Query Language (CQL) to search for items of interest in your code base. Very cool.

Here’s the CQL for finding Interfaces that have no implementations.

// <Name>Find interfaces without Derivatives</Name>
SELECT TYPES WHERE IsInterface AND NbChildren == 0