Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
... but if i look a the code 2 days after i wrote it, i don't understand it.

There's some very good advice above, with one caveat: we're not inside of your head, so we can only guess at why it is that you're having difficulties understanding your own code.

Solving this is going to require some introspection on your part. You're going to need to take a step that may be difficult: Each time you find yourself not understanding your code, step back for a moment and try to get more specific about what you're not understanding. Are you lost in the the structure? Are you lost trying to figure out what your regular expressions are doing? Are you lost trying to tell where things happen in your code? Are you lost trying to figure out why things happen in your code?

Once you've labeled a particular problem, a good step is to consider what you could have done up front (2 days earlier) to avoid that problem. This may using clearer variable names, or whitespace around certain syntactic elements, or more (or less) commentary. Without seeing your code through your eyes, it's hard for us to guess what you'll need to do.

The next step is an important one: Write your observations down. Keep a log. With a written record, you're more liable to see repeated patterns that you miss in day-to-day coding and debugging. And the mere act of writing problems down can be a creative stimulation.

You may find that you only need the log for a while. But if you start working on larger projects you'll run into a different class of problems, and you might want to start keeping a log again. A 250 line CGI script might seem large now, but one day you might find yourself working inside of a 250,000 line system.


In reply to (dws)Re: How to write long programs? by dws
in thread How to write long programms? by pokemonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found