Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^4: Avoiding silly programming mistakes

by JavaFan (Canon)
on Aug 20, 2008 at 15:37 UTC ( #705537=note: print w/replies, xml ) Need Help??

in reply to Re^3: Avoiding silly programming mistakes
in thread Avoiding silly programming mistakes

You are misreading my posts. Compeletely. I'm not against using strict or warnings - I use it in almost all my Perl code.

I am against the many posts suggesting to use 'strict' or 'warnings' when such things have little to do with a problem someone posts. At least, if you cannot contribute much to the problem except reciting mantra, come up something original. There are 254 other best practices mentioned in Damians book. ;-)

  • Comment on Re^4: Avoiding silly programming mistakes

Replies are listed 'Best First'.
Re^5: Avoiding silly programming mistakes
by mr_mischief (Monsignor) on Aug 22, 2008 at 20:37 UTC
    Considering the number of code problems strictures and warnings can help alleviate or eliminate, some won't answer questions or offer help regarding code which is written without them. Is that a good enough reason to convince people to use them?

      If people don't want to answer questions, then don't answer them. Don't answer them with answers that don't help to solve the problem; that's just clutter, and clutter reduces usefulness. Specially clutter that's found over and over and over again. If you can't contribute towards a useful answer, and you can't stop the urge to scribble something in the textbox and hit the "create" button, at least be original. Don't be Borg.

      If you ask for directions in a city where you are unfamiliar, would you welcome answers that say "you're better off wearing seat belts"? Over and over again? Regardless whether you are wearing them or not, it's not a useful answer.

        The OP was about avoiding silly programming mistakes. The responses given do that. The OP has since clarified the question, but that doesn't change the usefulness of the initial responses.

        I use Perl in order to avoid classes of potential errors, such as dangling pointers. I use certain modules (such as DBI) to avoid other classes of potential errors (such as SQL injection). Then, there are the ways to improve using Perl to avoid other classes of errors (such as = in a conditional test vs. ==). After that, there is experience which is what the OP was attempting to ask for. That's what my response addresses.

        As for this thread . . . have you ever tried to explain something to someone 10 years younger than you? That feeling of "Why can't you just understand the deeper subtleties" is what we're feeling right now with regards to your responses.

        My criteria for good software:
        1. Does it work?
        2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
        So you're homeless and you walk up to a soup kitchen. You ask "Can I have something to eat, it would solve my hunger problem.". They hand you potato soup. You reply "I don't like potato soup".

        There response is "Potato soup is high in calories and our nutritionist says it's the best food for someone in your situation. We've chosen this as the best food and everyone else seems to like it."

        You may not like it. It may not be what you were looking for. But many people have thought about the problem longer than you have and they have come up with a good solution.

        If you would like to add to the menu, that is great. If people like it they'll do it. But complaining about volunteer help with strawmen (seatbelt analogy) and ad hominem (borg comment) attacks is pointless.

        One dead unjugged rabbit fish later...

        These were the questions asked in the OP --

        What are your strategies for avoiding those 'doh' moments? ...are there things I could do now to reduce the number of silly mistakes I make?

        -- not how to avoid object destructor confusion which is a solved issue. use strict and use warnings might be a bit trite but it is the best advice to a newbie who asks for newbie advice, not "use 4-arg substr instead of lvalue substr" or almost any of the rest of the PBP. Which for the most part would not be good advice but showing off.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2018-05-21 22:58 GMT
Find Nodes?
    Voting Booth?