in reply to Should We Have A "Red Flags" Area?

No, I don't think we should. What is "good" coding and what isn't is very subjective. And that's also for what is a "red flag". Take for instance the first example. I do not agree that ($var1,$var2,$var3) = split is a red flag, let alone an obvious one.

Perlmonks is already too dogmatic IMO (for instance, all the chanting of "you didn't use 'strict' or 'warnings'" even for the smallest code fragments that wouldn't benefit at all from enabling strictness). I don't think a red flags area on Perlmonks would be a good thing.

Abigail, being kind fond of $& and friends.

Replies are listed 'Best First'.
Re(2): Should We Have A "Red Flags" Area?
by FoxtrotUniform (Prior) on Feb 17, 2003 at 03:51 UTC
      No, I don't think we should. What is "good" coding and what isn't is very subjective.

    I'd like to see a Red Flags area — or at least a series of Meditations along those lines — for exactly that reason. I think it'd be quite useful for us to declare our biases and preferences wrt. coding style and "dangerous practices", and refute/bitch about others' biases and preferences. If nothing else, having to defend our beliefs would make us think about why we like what we do, and would give us at least a bit of insight into coding practices.

    In my opinion, that's a win.

    --
    F o x t r o t U n i f o r m
    Found a typo in this node? /msg me
    The hell with paco, vote for Erudil!

      Thing is, "Red Flags" sounds too canonical. It sounds like "these are thing that may be empirically shown to be dangerous or wrong much of the time". If we want to write about our own coding styles, our biases and preferences, the way maybe we love to have dozens of variables like $user_address_streetaddress1 around, or the way we love to have pairs of parallel arrays instead of hashes... well, we've got Meditations, home nodes and scratchpads, Obfuscation, the CB, and other places depending on the specific bent of the rant.

      It seems to me wasteful and counter-productive to create a new section dedicated to "this is the way I like to do stuff, and you ought to as well." Already that list of links at the top of the page is kind of expansive; I wouldn't think a listing of "Red Flags" would be of enough benefit to warrant the creation of an entire section for it.

      LAI
      :eof

        If not "Red Flags", then how about "Red Herrings"? Do monks eat lots of fish?

        Acolyte
        Studying at the feet of the masters
(jeffa) 2Re: Should We Have A "Red Flags" Area?
by jeffa (Bishop) on Feb 17, 2003 at 16:14 UTC
    I hope that all chants of strict and warnings are directed towards those that don't know why they should use them, rather than those that do know why they shouldn't use them. This is not always the case of course ... but, i like to think of our chants as a means of undoing all the bad habits instilled in the late 1990's by Matt Wright's Scripts. ;)

    I agree with you in that i don't think we need a "Red Flag" area. Besides, merlyn does a pretty darned good job of flagging "Red Flag" code without such an area ... /duck

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
      All too often "use strict" and "use warnings" is chanted without addressing the problem the OP has. Or the problem is addressed, but whether "use strict" or "use warnings" was used is irrelevant.

      Wearing your seatbelts is a good thing, but giving that advice to someone who has problems getting anywhere because he's out of gas is completely irrelevant, and counterproductive.

      Abigail

Re: Re: Should We Have A "Red Flags" Area?
by Anonymous Monk on Feb 17, 2003 at 01:48 UTC

    Couldn't agree more. I'm not too familiar with Perl internals and perldelta but couldn't differences between implementations and releases also cause problems? For example what might be a bad practice in perl 5.8 on wintel might be the best way for perl 4 on solaris?

    Also, as for strict vars, why isn't this the specified behaviour for all perl programs? It's scoped that way in many other languages, why is Perl different? It seems to just be inviting trouble.

      Perl is different so you can write useful programs as one-liners.

        Placing my supreme opposition to obfuscation and other unecessarily dense code aside (every script should be clearly written and placed in a nice, well named little file with good documentation), why would you need a complete lack of proper scoping to create useful one liners? Could you provide a few examples? Thanks.