4 ms·
> "ifs are a smelly thing in a Object Oriented language." It is partially my fault because I failed to express what I really ment. English not my native, so so
by alisnic 14y ago
> "ifs are a smelly thing in a Object Oriented language."
It is partially my fault because I failed to express what I really ment. English not my native, so sorry.
What I really ment in this sentece is "why using (a lot of) ifs can be a bad practice in a Object Oriented language"
- raverbashing 14y agoOk, with that I can agree. Or maybe better: how can ifs be replaced (sometimes) using OO principles
- jeremiep 14y agoMy take on why ifs are "bad" is that they are statements, just like for, while, switch and others. Being statements they can't be composed as you would do with expressions.
- dragonwriter 14y agoThat's not universally true; there are languages where if is an expression rather than a statement (e.g., Ruby.)
- ufo 14y agoMost languages have a ternary if operator like (?:). I don't see how this is such a big issue.