title: avoiding if statements
body: <p>I was thinking about object oriented design today, and I was wondering if you should avoid if statements. My thought is that in any case where you require an if statement you can simply create two objects that implement the same method. The two method implementations would simply be the two possible branches of the original if statement.</p>
  
  <p>I realize that this seems extreme, but it seems as though you could try and argue it to some extent. Any thoughts on this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Wow that didn't take long. I suppose this is way too extreme. Is it possible to say though, that under OOP you should expect way less if statements? </p>
  
  <p><strong>SECOND EDIT</strong></p>
  
  <p>What about this: An object that determines its method implementation based on its attributes. That is to say you can implement <code>someMethod()</code> in two ways and specify some restrictions. At any point an object will route to the correct method implementation based on its properties. So in the case of <code>if(x &gt; 5)</code> just have two methods that rely on the <code>x</code> attribute</p>