Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Some of use just want to know the basics

by mothra (Hermit)
on Jan 25, 2001 at 05:52 UTC ( #54176=note: print w/replies, xml ) Need Help??


in reply to Some of use just want to know the basics

I'll offer my thoughts on copying and pasting, if only because I feel pretty strongly about them. :)

Never copy and paste code.

There's no magical reasoning for this. It's quite simple actually. When you innoncently think "oh! I'll just copy and paste this code here, make a few changes and I'll be finished!", it rarely works out that you actually REMEMBER to make all of the changes that were necessary.

Of course, I'm not talking about the copying and pasting associated with pieces of code that should be put into a module, but with pieces of code (perhaps even one if statement that you want to make into four) that "almost" do what you want, but not quite.

The one situation where I'll use copying and pasting is when writing stored procedures in SQL. It's much faster to copy and paste table names and columns (one at a time usually) than it is to keep retyping them.

  • Comment on Re: Some of use just want to know the basics

Replies are listed 'Best First'.
Re: Re: Some of us just want to know the basics
by lemming (Priest) on Jan 25, 2001 at 06:01 UTC

    For a real world example of cut-n-paste wrong doing: This idiot had made multiple modules with this error in it: The code was Info-Basic, but I'll present it "Perl" style

    for ($x=1; $x < 999; $x++) { ProcessAccountNumber($x); }
    He did this for every single number based item. ("Gee, we'll never see numbers that big.") Yes 999, for transactions he used 999999.

    Ow. remembering that hurt.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2019-06-19 04:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (83 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!