Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
In my experience, I generally follow these steps when approaching a "programming challenge":
  • Think about the problem. Try to look at the problem carefully from distinct angles. I always try to reduce the problem or to divide it into sub-problems. Many of those can probably become modules (that you write, or that you get from CPAN).

    Look for ways to make your approach as general as possible, so that the tool that you're writing will remain useful for as long as possible.

    Do not try to implement all the bells and whistles in the first pass. Stick to the basics and get a prototype running, then add features slowly. Test at each step.

  • Document before writing code. If you have a set of nice sub-problems to work at, focus on them one at a time. Chances are you can solve them easily with one or more modules.

    If this is the path you decided to follow, think a bit about the naming of the module, so that it reflects its function. Always start with h2ph. The very first thing to do after that, is to force yourself to write documentation for the module.

    Writing the documentation first sets very clearly your design and functionality goal. (After all, if you code first and it works, you know you'll never write the docs anyway). This also gives you a chance to design what the interface of the module will look like.

    If the docs you produce are detailed enough, you can spot problems before your test cases do, and plan on them ahead of time.

  • Code the modules AND the test cases Do both at once. Test cases must cover your code and insure that it is portable (yeah, I know this thingy you're writing only needs to be used this time...).

    Your code must be clean and easy to read. Add comments where decisions are taken in your code. Always use strict and -w. They're your friends.

I wish you luck and wisdom.

In reply to Re: best practice by fokat
in thread best practice by George_Sherston

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

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (2)
    As of 2020-10-25 14:33 GMT
    Find Nodes?
      Voting Booth?
      My favourite web site is:

      Results (249 votes). Check out past polls.