Keeping your classes immutable and stateless makes your code way less prone to bugs. Yet somehow this clean code rule isn’t as popular and as often invoked as SRP, YAGNI, DRY, KISS and others... Maybe it’s because of the lack of a catchy acronym?
Anyways, I’d like to take a look at two examples of when sticking to this rule could save your ass (or at least save you some time debugging).
There are many problems with the European Union. But that doesn’t mean the EU sucks! Quite the opposite!
The main one is that we take it for granted. Even the euro enthusiasts giving speeches during the Pulse Of Europe, even those old enough to remember the atrocities of war or the reality of divided Germany, say that they need to constantly remind themselves: the peace wasn’t always there, the free movement, free trade – that was was built quite recently, it still is being built, and it requires our effort to continue working.
As much as I love Cohen’s Hallelujah, there’s one verse that always bothered me. “Your faith was strong, but you needed proof”. Seriously? It’s not how those words work!
If you require proof or evidence to believe in something, it’s called common sense, not faith.
If you accepted some fact after being presented evidence for it, it’s called knowledge.
If you believe in something despite the lack of evidence, that’s faith.
It’s not that hard to get those words right.
“The EU is a bureaucratic monster!”
Well, it should be. It manages to connect 28 really different countries, with different legal orders, different economies, using 24 official languages and 11 currencies; plus a couple of loosely related countries (Norway, Switzerland, Vatican etc.); plus a shitload of dependent territories. What it does is amazing!
Bequemer Service für bestätigen und generieren von IBAN, TIN, ISBN, EAN, Kennwörter...