Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: OT (funny) How to write unmaintainable code

by explorer (Chaplain)
on Aug 22, 2006 at 18:37 UTC ( #568945=note: print w/replies, xml ) Need Help??

in reply to OT (funny) How to write unmaintainable code

Of Perl:

22. Avoid {}
: Never put in any { } surrounding your if/else blocks unless they are syntactically obligatory.
If you have a deeply nested mixture of if/else statements and blocks, especially with misleading
indentation, you can trip up even an expert maintenance programmer. For best results with
this technique, use Perl. You can pepper the code with additional ifs after the statements,
to amazing effect.


Perl Only
: Use trailing if's and unless's especially at the end of really long lines.
  • Comment on Re: OT (funny) How to write unmaintainable code

Replies are listed 'Best First'.
Re^2: OT (funny) How to write unmaintainable code
by Jenda (Abbot) on Aug 22, 2006 at 23:45 UTC

    Except that the "advice" 22. is not applicable to Perl since the {}s are always obligatory for if()s. The if statement modifier is a completely different beast. Though code like this:

    foo( 1, 2, s/sdfgdgI&^%#GG*&T$#/WRUGSkyug/) if ($x == 5);{ $gotcha->('dude'); ... }
    could cause some misunderstanding ;-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://568945]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2017-10-16 22:53 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (217 votes). Check out past polls.