The Service Locator base class anti-pattern

Something I have seen a lot of over the last few years is a lot of service location, particularly in base classes, particularly in Controllers. But not limited to there, it can happen anywhere we see base classes. Short rant about inheritance The longer I do this, the more I…

More small classes

Its a pretty common rule of thumb to avoid monoliths and write more small classes. Think about the solid principles. Single responsibility per class. This implies less in it. Smaller. Open for extension closed for modification. Take out the things that will change. Smaller. Liskov substitution principle says substitutability is…

Ports and Adapters

It feels like everywhere I turn (in my circles anyway), people are talking about Ports and Adapters, and I thought I would jump on the bandwagon. You may have also heard this architecture called Onion Architecture, or Hexagonal Architecture. All of these are essentially the same idea, under a different…

Semantics vs implementation detail

When we write out classes and variables, we are pretty good at naming them for what they represent. What I mean by this, is that when we declare a customer first name variable, we don't call it firstNameString, or cfnString, and we have also lost the bad habit of firstNameStr…