in reply to Virtues of Software Engineering
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
|
|---|