We 'like' to put blame on factors that (in our opinion) lie beyond our control - stone-carved deadlines, outdated legacy, unimaginative Product Owners who always dump tech debt-related work items into abyss of Nice-To-Have. Some call it 'victimship' & it's all about giving up at the slightest indication on resistance due to bias we've developed in our past (by ourselves or just learned from
A short post about unreasonable usage of State pattern - something I keep seeing every so often in code (regardless of language / platform).
What's a State pattern?
State pattern is a way to encapsulate state (& behaviour that depends upon it) within an object the state belongs to. It's a natural way to express physical reality (and its variability over time) in a conceptual
I have a weak spot for the policy design pattern since ol' good C++ times: I think it has all started when I've read one of Sutter's / Alexandrescu's books with some great examples of policies injected via template parameters. This way you could get a variable behavior without complex inheritance and excessive coupling. Today, the times of templates are long gone (trust me: C#