Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Seeking advice about learning another's code

by DBX (Pilgrim)
on Aug 02, 2001 at 02:46 UTC ( [id://101515]=note: print w/replies, xml ) Need Help??


in reply to Seeking advice about learning another's code

I can only offer you a couple of quick suggestions to get you started. Having been in this situation before, the first I start doing is commenting everything I DO understand. Then the parts that are not familiar or are very complex stand out and I can go back through on another pass and work it out.

The other thing I do that helps me tremendously is to start encapsulating sections of code into functions (especially when the script has been written in a procedural fashion as opposed to a function-oriented program) to clean up the flow. Instead of many confusing lines, you have a few function calls, some of which you will get and some you won't. It's much easier to dive into the function you don't get than to try to extract its meaning from all the context around it when the script has been written procedurally.

If you are on a deadline, what you may realize if you comment the code and put related code into functions is that you don't have to mess with some of the parts you don't understand. As long as they still work, you may only have to change or work with the rest of the script and you can go back when you have time and learn the rest.

I hope this makes sense and helps you.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-03-29 09:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found