Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Tales from the Crypt, 'use strict' Horror Stories

by ptkdb (Monk)
on Nov 17, 2003 at 14:50 UTC ( [id://307667]=perlquestion: print w/replies, xml ) Need Help??

ptkdb has asked for the wisdom of the Perl Monks concerning the following question:

Anyone got any good horror stories about 'use strict'?

I'm sure we've all got one version that goes like, "you told me to put 'use strict' at the top of my files and modules, and now it doesn't work at all!"

We should all have a rehersed speech that goes, "put these in. YES, I know your script won't even work now. YES, you do have time to work through 100s of error messages. You'll find that if you fix one of them, dozens start to go away. When you've gotten rid of all of these messages, start debugging again."

  • Comment on Tales from the Crypt, 'use strict' Horror Stories

Replies are listed 'Best First'.
Re: Tales from the Crypt, 'use strict' Horror Stories
by gmax (Abbot) on Nov 17, 2003 at 15:11 UTC
    Anyone got any good horror stories about 'use strict'?

    Sorry, I don't.

    As I consider myself to be a good listener, I started using strict from my very first script.

    However, I have many horror stories of trying to find a mistake in scripts written by somebody else, without "use strict" at the top.

    And yes, 9 out of 10, after working my way through hundreds of error messages, I found the mistake, which usually turned out to be a misspelled variable.

    What's your point? Are you trying to say that "use strict" is bad for your development time? If so, I'm afraid that you are barking at the wrong tree. The majority of the Monks could tell you many reasons why "use strict" can make you save development time, not the other way around.

    Programmers who don't use strict sooner or later run into trouble, and then they have to call somebody who makes money out of their carelessness. How about this for an horror story? BTW, would you like to play Dracula or the Vampire Hunter?:)

    I should also add some good references to the reasons:

     _  _ _  _  
    (_|| | |(_|><
     _|   
    
      Quite the opposite. 'use strict' costs seconds in the short term to add it and fix the resulting messages, but saves HOURS in the longer term.

      I'm trying to elicit "don't let this happen to you" tales, to encourage people to use it.

Re: Tales from the Crypt, 'use strict' Horror Stories
by jeffa (Bishop) on Nov 17, 2003 at 20:04 UTC

    "YES, you do have time to work through 100s of error messages."

    Having taught Computer Science labs in the past (C++), i noticed that many, many students try to write the entire program up front, then try to debug everything. I would force them to add/make one change at a time, save, compile, fix errors .. repeat. The idea is that if you only make one change, the error will be less ambigious, and you more than likely will know exactly where the problem is (but not always what).

    Strict keeps me from doing stupid stuff like i demonstrated many moons ago at (jeffa) Re: using. Unfortunately, it doesn't make me design my ideas before i start coding or stop at good points along the way for sanity checks and it sure doesn't enforce me to use CVS.

    In other words ... strict is just a small part of the solution, and i don't have any horror stories to tell because i always use it. :)

    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)
    
      Having taught Computer Science labs in the past (C++), i noticed that many, many students try to write the entire program up front, then try to debug everything.
      I used to do the labs that way during the first years when I was a student as well. But that's basically because you had to. Terminals were a commodity, and you had to make a reservation in advance. With a two hour limit a day. We were lucky if had terminal access more than three times a week. And programs were usually due 10 days after handing out the assignment. With several programming classes running in parallel. So, we usually ended up writing the complete programs by hand first, then typing it in when getting terminal access, hoping you could fix all the bugs in two hours!

      Abigail

Re: Tales from the Crypt, 'use strict' Horror Stories
by Paulster2 (Priest) on Nov 17, 2003 at 17:57 UTC

    Just a thought, but shouldn't the title of this be Tales from the Scrypt?

    Just a thought.

    Paulster2

Re: Tales from the Crypt, 'use strict' Horror Stories
by Anonymous Monk on Nov 17, 2003 at 18:07 UTC

    There are no horror stories about using strict. Those that do have them either: a) recognize that going strict compliant just saved them from potential horror stories and thus do not consider it a strict horror story, or b) don't recognize the above and do without strict and have other horror stories that they'll never admit have anything to do with not using strict. Is this teleological reasoning? Sure, but that doesn't make it any less true :-)

Re: Tales from the Crypt, 'use strict' Horror Stories
by rinceWind (Monsignor) on Nov 19, 2003 at 14:07 UTC
    Anyone got any good horror stories about 'use strict'?
    Perhaps, with hindsight, you would have been better off phrasing your question: "Anyone got any good horror stories about not using strict? At least others would have understood your point of view.

    There is one node, here where I recount my experiences, but I guess it's more of a happy tale than a horror story :).

    --rinceWind

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://307667]
Approved by broquaint
Front-paged by Courage
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-24 23:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found