Clear questions and runnable code
get the best and fastest answer
Seeking advice about learning another's codeby E-Bitch (Pilgrim)
|on Aug 02, 2001 at 02:31 UTC||Need Help??|
E-Bitch has asked for the
wisdom of the Perl Monks concerning the following question:
This is more of a conceptual question, so it probably needs to be moved (such is my luck), but here goes:
So, I'm at work right (all the good stories start out this way... stop me if you've heard this before) when my supervisor says, "Hey, <insert division name here> has this really cool database verification script that checks the lines of a pipe delimited file for accuracy / formatting, and if each line passes, puts it into the database, and if it fails, emails the owner of the particular line of the file. Here is the script, can you figure it out, and get one like it running by next week for our database?"
<insert foot into mouth>Uh... (fearing job security) Sure!</insert foot into mouth>
So, now I'm pouring through this 1200 line perl script with another 1200 lines of sql scripting standing behind it going, "Uh... damn... shouldnt have said that."
My question for the monks around here is this:
I have figured out other's code before, but never on this scale before. I have begun to write / draw the UML diagram for this (I think this is UML, at least, but if not, its the diagram that has conditional statements in the diamonds, with lines to show program flow...) and have gone through pages. (Yea, I can hear you already, use a program that does the UML diagram for you... but I want to draw it... :)
So, does anyone have any tips on figuring out large blocks of uncommented code? <shiver>
I see a lot of stuff that I know about, and many things that I can figure out (like perl's database access routines), and a few things that I have no clue on (like this: $pipecount = tr/|//;). I have only known perl for like 5 months, and havent had too much time to devote to it for pleasureful programming. I have the camel, but what are good ways to go about this (by next week?)