Monday, April 29, 2019

Don't Nest Too Deep


Nesting IF-THEN-ELSE statements greatly simplifies programming logic. On the other hand, nesting them more than, say, three levels deep decreases their understandability considerably. The human mind is capable of remembering only a certain amount of logic before it becomes confused. A variety of simple techniques can be used to reduce nesting.


Reference:
McConnell, S., Code Complete, Redmond, WA: Microsoft Press, 1993.