Post XtC thoughts: Frameworks /

Post XtC thoughts:

Frameworks / Infrastructure code / Plumbing, call it what you will. It should be easy, really easy to use. If the framework coders have to perform unnatural acts to ensure that the users of the framework don’t have to, so be it. That’s part of the appeal anyway (or is that just me?). Writing frameworks is something of a masochistic activity in that sense. Producing something that is so easy to use its almost a no-brainer. Hard to use frameworks won’t get used. Or if they do, they’ll probably be misused. Its a tough balance. You want to make the lives of developers using your framework easier, without making their decisions for them, or taking away control.

AltRMI is a good example of a framework done well – its what RMI should have been. Simple exterior, clever interior.

Paul Hammant had some wise words to say on interface / implementation separation. So important for reuse, testability, just about everything thats worth having. The collections stuff from Java 1.2 being a good example:

 Map myMap = new HashMap(); 

What if I want a map that survives restarts?

 Map myMap = new PersistentMap();

Done and dusted. No client code ever needs to know. The counter example being java.io.File. What if I want to slot in a caching file layer? or some other data source that pretends to be a file? Out of luck…

Want reusable code? Interface – implementation separation.

Advertisements