Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Code re-use: productivity gains vs. skill deprecation

by brianarn (Chaplain)
on May 22, 2002 at 16:21 UTC ( [id://168502]=note: print w/replies, xml ) Need Help??


in reply to Code re-use: productivity gains vs. skill deprecation

I really like how Molt breaks it down into productivity vs. experimental, and have some thoughts akin to it.

Currently, I'm a CS student at the University of New Mexico, and as such I've reinvented a lot of wheels in my educational career, from simplistic C++ programs that take simple input such as 3d+2 and produce output such as 12, to implementing my own stacks/queues/lists, only to find that someone else had already created it (in the C++ world, the STL was an incredible thing to learn about). Had I not reinvented the wheel in these educational instances, rather than just used some prefab template, I feel like I wouldn't have gotten much out of the experience. Granted, when I was first shown some of the more advanced code available to me, I was frustrated to have had to go through my own creation process, but have since realized the true value I received from developing my own linked lists/trees/stacks/queues etc.

I'm also a systems programmer for my university, and as such I write perl scripts like there's no tomorrow, simple 'throw-away' scripts most of the time, sometimes large complex CGI apps. No matter what I'm writing, I try and reuse code anywhere I can get my hands on it, from simple things I'd written for myself as a playground to other past throw-aways. As such, even when I'm writing a simple script that I am told will only be ran once, warnings and strict are always a part of it. A friend of mine who is a Perl coder but non-monk and I get into fun arguments about throw-aways. He'll actually use $filecontents = `cat $filename` to read in a file for a fast throwaway - nothing irks me more. I'm just waiting for the day that he hands this throwaway to someone who blows it out into a giant app, and then some malicious user sets $filename to "; rm -rf /"

One area where I've been stuck is not having the ability to install CPAN modules (I'm actually forbidden from installing anything on a production machine) - so there are times when I have to do a little reinventing, but half of the time if it's a small module, I'll install it on my machine, open it up and see what they did, and potentially copy the code verbatim over into my script - it makes the script bigger, but I get tried and true code that works.

Reinventing pieces of code has great merits in an educational sense, and I think that any developer/sysadmin worth anything will probably rewrite many pieces of code in order to learn. Reading code is a wonderful way to learn good habits (so long as you take away the Good and leave the Bad), but I feel that actually going out and writing/debugging your own version is an excellent learning experience as well.

~Brian

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-26 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found