PBP: 077 Multipart Selections

The PBP say “Avoid cascading an if.”  At first glance, this sounds like a pretty harsh suggestion.  As it turns out, I rarely ever have any issue following this suggestion.  Well organized code seems not to need long if/elsif/elsif/elsif/elsif/else blocks.

Mr. Conway gives two reasons to avoid this construct, performance and readability.  I find them both plausible arguments.  I don’t know that I find the problem such a big problem that it needs to be prevented.  In my experience, good code doesn’t run into this.  I forget Perl has a specific elsif clause most of the time.

The next couple of entries cover common ways to avoid them.


One Response to “PBP: 077 Multipart Selections”

  1. Shawn H Corey says:

    I don’t see how one can write a lex(1) parser without one.

Leave a Reply