|Welcome to the Monastery|
So you know Perl; but do you know programming?by Marza (Vicar)
|on Jul 03, 2002 at 23:24 UTC||Need Help??|
I never considered myself a talented coder/programmer/scipter but I know enough to build some useful tools that don't break.....often ;)
As with many shops we have scripts that you "don't touch because they work." One in particular is our Unix account creater that was written by a "Perl Guru" who was paid a great deal of money to automate several funtions.
After taking a class, reading a few books, reading stuff from the Net, and writing a few reports. I was asked to add a "feature" to the account creater.
I reviewd the source and I now want to be a consultant. The guy who wrote this "automation" took a rather heavy handed approach.
The following is a piece of the mess. Basically, you are prompted for a username, the passwd file gets loaded to an array, it checks for duplicates, and it looks for an open userid:
Like I said, it does the job but in a rather heavy handed way. Guess the guy never heard of hashing.
I suggested a re-write and of course the bosses heart rate went up. So I just got the above example and threw together some code to show a difference.
After seeing the reduction, he ok'd the rewrite.
Powerful computers can be a friend as well as an enemy. Sure the script does the job and it isn't even slow, but was the approach right? I don't think so. In this age of "put it in now, we will fix it later" bad code seems to slip in more and more. I should ask for a bonus for rewriting the "experts" scripts. ;)
All in all, I guess this is an example of how you should have people that understand the language and programming in general to interview consultants.
Edited: 04 July 2002, by footpad