Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
"be consistent"
 
PerlMonks  

Re^11: VarStructor 1.0

by Jenda (Abbot)
on Sep 02, 2004 at 12:37 UTC ( [id://387985]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Re^9: VarStructor 1.0
in thread VarStructor 1.0

Considering the size of the module 15 is few. Besides there are resonable uses from globals and there are the unreasonable ones. In this case it's just some configuration variables, nothing that keeps changing and needs to be worried about.

I'll go out on a limb and say that a talented and experienced programmer would get the job done faster if he didn't use strict, assuming he learned that way or has an equal amount of experience both ways.

And here is where most of monks doesn't agree. At least if the task is something that will take more than 20 lines of code. But it's hard to give you a hard evidence since all talented and experienced programmers with equal experience both ways use strict whenever they can and only turn it off if they need to do something spicy.

In some other node you said it's easy to devise a new variable name and scan the script to make sure it's really not being used yet. Isn't it even easier not to have to do that? And is not

foreach my $line (something) {
easier to write and read than
foreach $lineIuseHereAndOnlyHere (something) {
? I use lexicals so I don't have to care whether there is another variable with the same name in a different part of the code. I use lexicals so I can take a piece of code and copy it somewhere without worrying that the two copies will overwrite each others stuff. I use lexicals.

Jenda
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
   -- Rick Osborne

Replies are listed 'Best First'.
Re^12: VarStructor 1.0
by Wassercrats (Initiate) on Sep 02, 2004 at 14:03 UTC
    You said "...you said it's easy to devise a new variable name and scan the script to make sure it's really not being used yet. Isn't it even easier not to have to do that?"

    It depends on the situation. It's faster to do a search than to type "my" 50 times. Sometimes you could recognize that a variable has or hasn't been used before, and variables as long as your example of "$lineIuseHereAndOnlyHere" aren't necessary to make sure you know where belong and avoid accidental reuse, even in a 3000 line program. I know, because I wrote such a program.

    I'm not trying to talk anyone into using more globals. I just posted VarSructor, and if you have no use for it at the moment because you don't have to maintain a script that might have globals that you want to locate in the easiest way possible (seems like my detractors would be interested in that so they could refactor it), and if you don't have to reset variables in someone else's script so you could safely loop it without a major rewrite, then don't use the script.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://387985]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.