Tag: exercises
Eliminate Branching (IF Statements) to Produce Better Code
by Chris Wash on Jan.07, 2010, under Developer Testing, Software Engineering
In a recent tech talk, I watched Miško Hevery propose an interesting challenge to his audience: start a toy project and try to write the code with no if-else or switch blocks at all. None at all? Before thinking about how to do this, why would you want to do it in the first place? On the surface, it may seem to the unassuming a bit counter-intuitive. Comparison-based branching is at the heart of programming, and the concept of an if-else or switch block is almost universal, existing in most every programming language ever devised. What’s Hevery’s agenda with this exercise – and what can possibly be gained from trying to write a program without branching entirely?
