The Special Case Pattern - Explained (OOP)

_config.yml

Consider the following code:

Think about how it can be improved?

_config.yml

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