I've been having an interesting discussion on the JUnit mailing list over the past couple of days with Elliotte Rusty Harold and a few other people. We've gone back and forth about the need for preconditions in APIs, finality, and whether conventions can replace language constructs as we strive to make APIs that are easier to use.
One thing that struck me today is how much discussions about API development tend to parallel discussions in contemporary politics. Your position seems to depends upon where you stand on the following questions.. Should rules be enforced strictly? Should people be responsible for their choices? And, if you attempt to protect people too much will it lead to bad behavior?
Lawrence Lessig wrote a while ago that code is law but it is a bit different from other types of law. Real laws aren't enforced automatically. You can break them.. or tweak them to good effect. 'Fair Use', for instance, is an exception to copyright law. But, if law is enforced via code (think DRM) there is no gray area, no chance for local exceptions or traditions like fair use.
The same thing happens with API code. API developers often want to lock down their APIs and make them strict. They do this for a variety of reasons, but when they do they often make other things difficult. You can't do much that wasn't envisioned by the designer.
I've noticed this problem most often in testing situations. I've been nursing wounds on that issue for a while, and I'll have more to say about it later.
In other news.. I was at the store today and I noticed that I have one more way to get my dark chocolate fix.
Here's hoping that the market likes'em.
This is super interesting, have you encountered more writing on the subject?
Posted by: Mushon | November 02, 2009 at 01:00 PM