Check out this dialog I had with a perl-beginner@yahoo subscriber starting with the head message. In essence, he took a 5000-line "auction" script written perl4 style from the mid-90's, updated it a bit, then posted it as an example of "good code for beginners to learn from".
Yeah, maybe as an example of what not to do!
I can't tell whether I should be more scared about his defensiveness at being called to the carpet, or the fact that the script has about a half dozen eval-string ops, generally taking their operand from unchecked CGI form fields. Yuck.
His retort is interesting:
"Newbies don't start programming perl by using packages and/or objects. I'm very sure that the use of packages and/or objects is 'overcoded' in case of a simple program like this.
He's right that new Perl programmers won't jump right in to packages and objects -- though I don't know what makes him think they'll jump in to a 5000-line auction script.
And if a 5000-line script isn't screaming for modularization, I don't know what is.
Re:*sigh*
Ovid on 2004-03-22T19:39:01
A long time ago I learned a term that's stuck with me to this day: position release. When I have an obstacle to personal growth or learning, it means that I have some sort of personal position on a matter that I need to let go of. Even to this day, I have to constantly remind myself that when someone points out another way of doing something, even if I disagree with it, I need to figure out why they're pointing it out so I can attempt to learn from them. It's a tough thing to do.
Alternate realities
merlyn on 2004-03-22T19:45:12
Another way of saying that is that no matter how crazy someone sounds to you, there is a reality in which what they said makes sense, and they're apparently living in that reality. It's a useful mind exercise to be able to reconstruct their reality: it's also useful for diffusing a rapidly escalating disagreement.Not that I ever apparently do that, of course. {grin}
using packages
jmm on 2004-03-22T20:07:17
There is also a huge difference between writing packages and using available packages.Telling a beginner how to use a package that cuts down the code they would write from 5000 lines (to choose a random number
:-) down to a few dozen lines that focus on the overall operation and leave the details to the underlying package is a necessary and important lesson that should happen early.
Re:Ugh indeed
Ovid on 2004-03-22T20:19:22
I have a friend who's doing a complete rewrite of Webmin using strict, automatic tests, modules, etc. I believe he wants to sell it as a commercial product, though.
Re:Ugh indeed
WebDragon on 2004-03-22T21:31:33
Damn! why didn't I think of that?:o)