There's more than one way to do things | |
PerlMonks |
Re^3: A short, "iffy" rantby SpanishInquisition (Pilgrim) |
on Oct 12, 2004 at 18:40 UTC ( [id://398648]=note: print w/replies, xml ) | Need Help?? |
Yep, I agree with that, and I was referring to it. "Considered harmful" should be "considered harmful". Tongue and cheek rarely works on the internet, hence confusion.
As your if/elsif/else construct grows, the dispatch solution becomes easier to read and maintain No doubt about it. But what about
Bad code, agreed ... but that doesn't translate into a dispatch table. I am quite the fan of dispatch tables. Dispatch tables work great for scalars if you are only testing scalars, usually your conditionals are more complex. I too, use the ternary operator most of the time (but never nested), as many things more complex imply too complex ... hence they can be redesigned ... but not always. Sometimes efficiency is important, and sometimes an if needs to be. Heck, sometimes if you pass through once a switch is what you want (but hey, perl doesn't have a good switch that is implemented without a source filter).
In Section
Meditations
|
|