Problem
People using too many if-s in a single piece of code, resulting in convoluted logic that is difficult for most humans to trace.https://cirillocompany.de/pages/anti-if-campaign
Solution:
What can you do about IFs?
https://code.joejag.com/2016/anti-if-the-missing-patterns.html
Use polymorphism if applicable.
Break it down into functions. Ideally, every function should only descend one level of abstraction. Following this, one can get extremely reusable code, although this does mean a lot more typing, initially.
Analysis
Software code is a form of written communication for humans, as much as it is for computers.Paying attention to these small details makes a massive difference in the face of any code beyond 100 lines.
You cannot really develop reliable software without this.
No comments:
Post a Comment