Hi Frederic!

Thanks for taking the time to read and reply to my story! Much appreciated :)

4 and 5 are all about creating extensible software, which is impossible with if-else.

4. Converting it into a switch does not help. The whole idea here is to remove if-else/switches entirely so that you can dynamically add new branches to the dictionary. As I also stated, the dictionary should come from somewhere else, and not be created inside the function.

5. It has seriously happened a lot in my career :)
It also does provide you with a super smooth way of just adding a new class in order to extend your application. It’s easy for all developers on a given project, when you don’t have to track down where to add another else-if statement.

Written by

Tech writer with 621K+ views. Sharing my opinion and what I learn. Danish C# backend engineer in FinTech. Ex Big4 senior tech consultant.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store