Augmenting the evolving API

Recently I’ve been confronted with some collective distaste of my in-house framework’s api. It’s been enlightening learning how my original design is failing to meet the needs of the small (but growing) developer community.  Like any API, mine prescribes a set of types which are, via the associated framework, injected into developer-provided “components” at run-time. Behind these types are of course, concrete implementations, and in one particular case, instances of MDIWindow of the popular Flexlib library. So the specific problem that folks are running into is that these APIs are a tad too generic. As a project owner, I have to provide regular release cycles, and as a result, changes/enhancements to the api need to applied  to scheduled releases. That is to say, if 90% of the developer community is screaming for a “public woobie():void” on the API, it can’t just be slapped on, it has to be implemented during the course of our normal sprint cycle. And after reading the landmark work of 37 signals, Getting Real, I tend to look at adding functionality like adopting children.

But it’s all good. ActionScript (like its cousin JavaScript) allows for the “targeting” of fields.

Consider the following..

public class ThirdPartyThing{
  public function woobie():void{...}
}

public interface IMyApiThing{
  function someApiMethod():void;
}

public class MyThing extends ThirdPartyThing implements IMyApiThing{
  public function someApiMethod():void{...}

}

And then, any client of IMyApiThing can access the “formal” API via instanceOfIMyApiThing.someApiMethod();

or the informal API via instanceOfIMyApiThing[“woobie”]();

I understand how that actually kinda sucks. Ideally, an API exposes the correct interface. But in reality, living things evolve. The API of a thing is collectively designed  by the community that uses (and curses) it.  This post is mostly about the relevance of “targeting” as a mechanism to derive and evolve an API. My view is that every time a user targets a field not exposed by the API, it’s a cue to consider adopting that targeted field as a 1st class citizen. And for that reason, I’ve been encouraging people to target-away – but just let me know about it so that the gorilla tactics of targeting can inform the design of a relevant API.

2 comments

Leave a comment