Showing posts with label Design. Show all posts
Showing posts with label Design. Show all posts

Thursday, September 13, 2012

A Design pattern to avoid if-else ladder


Did you ever wrote a code that is having a long if else ladder? and did you ever thought of avoiding it? I am sure you would have written if else ladders atleast once. So what is wrong with it? Nothing special, one time I had to review a code that was having miles long if-else ladder and after scrolling so much and reviewing the code I had to put a plaster on my right hand index finger. [just kidding :) ]