If I'm creating a new object (or subclassing an existing one) and it's relatively non-trivial, I find one of the best things to do is create code that uses the object. Act as if the necessary modules have already been written and don't worry about how they'll be implemented, just how you'll use them.

I used this recently for adding import and export functionality to SPOPS, and it seems to have worked very well. Of course, from there it's only one step to coding your tests first. And from there a simple five steps to conquering the world. Who would have known?

This has two attractive side-benefits. The first is that you tend toward simple interfaces. I don't like complicated interfaces as a user, so I won't write sample code that uses them. This is opposed to my developer-side, which in a vacuum creates kitchen-sink-functionality dealing with cases that will rarely (if that) occur and then pares it down afterward. I'm trying to unlearn this bad habit (practice, practice!), and this helps tremendously.

The second benefit is that if you have any confusion about what you're doing with your module, creating implementation code will help clear it away. (Other people clear away confusion by being really smart, which unfortunately isn't available through an 800 number...)

Chris
M-x auto-bs-mode


In reply to Re: Virtues of Software Engineering by lachoy
in thread Virtues of Software Engineering by vladb

Title:
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, details, 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, summary, 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.