in reply to Conditional Elimination
Conditional Elimination: it can't be done. All you can do is to move the conditionals to somewhere else and to make it clear what your code is doing. It's always worth remembering that:
Programs must be written for people to read, and only incidentally for machines to execute.
Which begs the question 'how do you do this?' There are a few possibilities.
Of course, each of these depends on what the code actually does, and how it can be simplified. IME, and all things being equal (which they rarely are), I'd probably try dispatch tables first.
I'd just like to reiterate that, in each of the suggestions above, you are not eliminating the conditions, you're just moving them somewhere else in the code.
As an aside, I'd like to throw in that, doing any of this takes time. Making code beautiful can take lots of time and we all have limited resources. So you might want to ask yourself, 'is it worth it?'
|
|---|