The Special Case Pattern - Explained (OOP)
Consider the following code:
Think about how it can be improved?
Stop! And think carefully, try to answer how you could improve the code without losing anything?
This has a name. It’s called the Special Case pattern. The basic gist is that you don’t handle special cases in the client. Return an object and let the object handle it!
Written on January 22, 2018