Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jarich (4909)

jarich
  (email not shown publicly)
http://www.perltraining.com.au/
AOL IM: ManningBear (Add Buddy, Send Message)

I run Perl Training Australia [perltraining.com.au] with pjf [perl.org] and do a lot of the course writing and maintenance. I also organise the courses we run, so if you want one, just ask. I hang around a bit on Perlmonks [perlmonks.org] and also help run Melbourne Perl Mongers [pm.org].

Journal of jarich (4909)

Monday December 19, 2005
05:38 AM

Interface design

[ #28052 ]

It appears to me that many API's of in-house projects just happen. Instead of design meetings to discuss what a subroutine should return in each relevant case (success, failure, error), it's instead left to the developer to pick whatever they think is appropriate at the time. Unfortunately the developer can occasionally get it wrong.

Now I admit that it can be hard work to come up with a good interface. I'm certainly not perfect at it myself. Often I go over old code of mine and cringe at the decisions I made. Usually this happens when I realise that had I written it better, I could probably be reusing some of that code for my latest project.

Some bad user interface issues can be worked around. There's the classic case where you fix (and rename) the original and create a wrapper that has the old behaviour. Or alternately, you break up the original so that you now have a handy subroutine which does the small but important bit you'd otherwise have to duplicate.

Some times the bad user interface issues can't be fixed. Perhaps there's a freeze on the API, or too much code depends on things being exactly the way they are (weird side effects and all). Some times there are "political issues" with such changes and other times the issue is with the required review and re-review process.

Fortunately, as I'm discovering, most of the horrible issues with solving interfaces can be happily avoided at the start, with test cases. Surely you'll test for success, failure and error? That will help you define right then and there what should happen in each case. Test cases are great at providing use cases at the function level. And of course at each level above that.

Now I just have to finish reading Ian and chromatic's book and start using them properly.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.