February 6, 2008

...Learn TDD with Codemanship

Suggestion For Class Repackaging Tool

Pairing with developers yesterday on repackaging their classes (on my advice, they started with just one .NET assembly with everything in it, and are repackaging to optimise the component architecture as the code evolves). Our aim was to break the one assembly into at least two smaller assemblies, with optimal cohesion and minimal coupling between them.

I suggested we use NDepend to help us visualise the dependencies between the classes. To be fair, the tool gets us some of the way there by producing a dependency diagram of the existing classes. We printed this off and drew lines on the page to denote potential package boundaries.

Dependencies that stay entirely inside one of these package boundary lines represents an internal relationship - adding to the package's relational cohesion. Dependencies crossing these boundaries represent package-level couplings. We want to draw the lines where cohesion is highest and inter-package coupling is lowest.

How the tool could make it easier would be to allow us to show package boundaries in the dependency diagram and allow us to move classes between packages (or redraw the boundaries) to explore packaging strategies. The tool could recalculate package coupling and cohesion with every change. It might even be able to locate clusters (or "cliques") in the dependency network and suggest where the boundaries could go.

If it's not possible for the NDepend developers to add this, then maybe a new tool could be created using an NDepend analysis output and some kind of graphing UI widget?

Posted 10 years, 5 months ago on February 6, 2008