Interview with one of the best API designer in the world -Joshua Bloch.
Adding some other interesting wise quotes on API design that I have read...
When you design user interfaces, it's a good idea to keep two principles in mind:
Users don't have the manual, and if they did, they wouldn't read it.In fact, users can't read
anything, and if they could, they wouldn't want to.
Same rule applies for API designers as well:
Developers don't have the java docs, and if they did, they wouldn't read it.In fact, Developers can't read anything other than pressing "." against the object reference in IDE & wait for something to select, and if they could, they wouldn't want to.
Learnability,Effeciency,Memorability,Errors & Satisfaction remains the core of good interface design.
APIs should emerge from the needs of real applications, and that they should make common tasks super-easy as the demand for quality, validated designs far exceeds our capacity to create them.In 1996 it wasn't clear we could create a sufficiently fast language without primitive types and arrays, It wasn't clear how much boilerplate code would be required by anonymous callback classes or checked exception. So Java couldn't resist including primitive types,excluding closures in favour of anonymous classes & over-using checked exceptions.
Grady Booch->
"Great thing about objects is that they can be replaced". The great thing about Spring is it helps you replace them. Flexibility is much more important than the re-use.
Joshua Bloch says,
- Public APIs are forever - one chance to get it right
- Good code is modular–each module has an API
- Thinking in terms of APIs improves code quality
- Easy to use, even without documentation
- Don’t let implementation details “leak” into API
- Make classes and members as private as possible
- Make variables "final" wherever possible
Now some economics:
Economic reality suggest that buying more memory can be easier and cheaper than to pay someone to debug code & it pays more in the long run to have understandable slow code than super fast cryptic code.
Once I heard from Architect in IBM conference (don;t remember the name) for choosing Java over C++ saying this,
"The most compelling reason for adopting Java over C++ is automatic memory management. It protects application from mediocre programmers. It eliminates many embarrassments of memory leaks & crash that randomly occur in production". He went on say that "So as a result we are trading with inexplicable crashes for slow performance (automatic memory management & database-centric storage).This makes sure that application at least works anyway"
"Rushing is at the root of all lack of quality" - Peter Calthorpe, architect
Reference: