Article Review: N Degrees of Separation

time to read 2 min | 280 words

Following Frans Bouma's recommendation, I just read N Degrees of Separation: Multi-Dimensional Separation of Concerns.

I came away decidedly unimpressed.

First things first, the article is boring. And SoC is a subject that is near & dear to my heart.

More importantly, I don't like the way they are approaching the solution, even if I agree with their overall premise. The idea that they present is that we should have a way to split functionality not based on a single parameter, but on multiplies of them. To that I agree, most certainly.

Except that the example that they gave was about as real as a three dollar bill. They give an example of an AST and needing to add functionality to it later on. The problem is that this is more or less a solved problem. AST + Visitor == very easily extensibility. I can solve the problem they present by using additive changes only.

They seem to think that major modification to the code is required, although I am not sure why. I'll admit that perhaps it was a poorly chosen example.

What bothers me even more is that their chosen solution is... Partial classes.

Now, I had some small experience in building complex systems, which I need to be able to change at low cost. Here is how I would implement this "N Degrees of Separation":

  • Kernel domain
  • IValidator<TEntity>
  • IPersister<TEntity>
  • IVisitor<TEntity>
  • IUponWhichTheAnglesDance<TPin>

I think you get the idea by now.

Add this to the IoC and you have solved the issue of feature changes. You just define an interface for a specific feature, add a rule to the IoC and you are done.