Thursday, March 26, 2009

Why I Don't Like SOLID Principles

SOLID princples:
  • Single responsibility principle
  • Open-closed principle
  • Liskov substitution principle
  • Interface segregation principle
  • Dependency inversion principle
This topic has been discussed to death in the tech circles, thanks to the whole tiff started by Jeff Atwood and Joel Spolsky. I'm just throwing my piece in the ring:


SOLID is good.
SOLID is not gospel.

The first rule of programming should be "use your brain." The first answer should always be "it depends." SOLID is not a silver bullet (because, as we know, there is no such bullet). There are going to be times where you need to write some code that is not pretty. Sometimes we acrue technical debt for valid reasons. Usually the reason is we need to implement some feature or bug fix fast, possibly because we're losing customers.

It really comes down to what Jeff said: "Quality really doesn't matter that much, in the big scheme of things." What matters is what we deliver to the customer. Of course, good code quality helps you deliver more and better apps to the customer. But the customer does not care that you followed the SOLID principles to the letter as long as the product is right.
Post a Comment
All rights reserved. Take that!