Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^6: On Commenting Out 'use strict;'

by bofh_of_oz (Hermit)
on Aug 11, 2005 at 14:18 UTC ( [id://482970]=note: print w/replies, xml ) Need Help??


in reply to Re^5: On Commenting Out 'use strict;'
in thread On Commenting Out 'use strict;'

First case: yes, the program runs fine. And while I agree that the program does not contain bugs *now*, not declaring variables can become a habit and someday create a BIG problem in a large program (trivial mistake: misspelling), which could've been avoided with "use strict".

It's all about personal preferences, after all. I prefer to use the abilities of Perl to force myself to write flawless programs that do not have syntax errors, do not produce warnings, and do not have (hopefully) logical errors. I came to that point of view when I was coding Basic and then reinforced when dealing with badly written VB programs.

Warnings, as I've mentioned, are a different story. I do not turn them on until I've dealt with errors since I believe that getting rid of warnings is a stage when I "polish" the program to make it not only working, but "flawlessly working".

If you prefer to have flexibility at expense of possibility to introduce hard-to-find errors that could've been avoided in the first place, that's your choice. I'm just providing the grounds/reasons for mine.

--------------------------------
An idea is not responsible for the people who believe in it...

Replies are listed 'Best First'.
Re^7: On Commenting Out 'use strict;'
by Anonymous Monk on Aug 11, 2005 at 15:40 UTC
    And while I agree that the program does not contain bugs *now*, not declaring variables can become a habit and someday create a BIG problem in a large program (trivial mistake: misspelling), which could've been avoided with "use strict".
    I never said 'use strict' wasn't a good idea. I just want to point out 'use strict' isn't a magical bullet - it doesn't find all the bugs people something think 'use strict' will avoid, and it has its share of false negatives as well.
    It's all about personal preferences, after all. I prefer to use the abilities of Perl to force myself to write flawless programs that do not have syntax errors, do not produce warnings, and do not have (hopefully) logical errors.
    That's exactly the sentiment I warn against. There is no such ability in Perl. 'use strict' or 'use warnings' don't force you to write flawless programs. They certainly don't prevent you to write syntax errors (and if you do, they don't find them either - the compiler will though). 'use strict' is more like a harsh driving school teacher that slaps you and puts the car in neutral when you don't look in the mirrors. But just looking in the mirror won't prevent you from crashing the car - and you're a worse driver if you think all you need to do is look in the mirror. Looking in the mirror is a good thing, but it doesn't stop there.
    Warnings, as I've mentioned, are a different story. I do not turn them on until I've dealt with errors since I believe that getting rid of warnings is a stage when I "polish" the program to make it not only working, but "flawlessly working".
    I have a hard time of believing that's an efficient way of developing a program. I always start with 'use warnings', and then when a warning pops up, I fix the cause, or (locally) turn of the warning, whatever is appropriate.
    If you prefer to have flexibility at expense of possibility to introduce hard-to-find errors that could've been avoided in the first place, that's your choice. I'm just providing the grounds/reasons for mine.
    Once again, I'm not advocating to leave out 'use strict'. I'm just pointing out it's just a tool - not a magic bullet.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://482970]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 21:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found