How to Get Rid of Annoying IFs Forever

Written by mcsee | Published 2020/11/08
Tech Story Tags: pixel-face | refactoring | object-oriented-design | software-development | coding | clean-code | code-smells | hackernoon-top-story | web-monetization

TLDR Most IF sentences are coupled to accidental decisions. This coupling generates ripple effect and make code harder to maintain. Ifs open doors to even worse problems, like switches, cases, defaults, return, continue and breaks. They make algorithms darker and force us to build accidentally complex solutions. Part II: Create a Polymorphic Hierarchy for every IF condition (if it doesn’t already exist). Move every IF Body to the former abstraction. Replace IF Call by polymorphic method call.via the TL;DR App

no story

Written by mcsee | I’m a sr software engineer specialized in Clean Code, Design and TDD Book "Clean Code Cookbook" 500+ articles written
Published by HackerNoon on 2020/11/08