Three months ago I released an open source js library: occamsrazor.js
I firmly believe that it is very useful. Sadly I haven't had any real feedback (excepts Simone Orsi who stated "Cool experiment!" ... Thank you ).
I think It's important to listen to the feedback, even when there is not. Often people are too kind to give a sincere feedback when your work sucks. And if they don't understand what a library is for. They simply don't use it.
I slowly understood that a real example is very important to understand how a library can be useful.
So I started to work on a little demo (I'll release it as soon as possible).
Using my own library I started to think: "wow the library is useful but the API sucks !!!"
So I rewrote the API.
These are the lessons I learned:
Remove all the feature except the fundamentalsI usually follow this design principle:
"It seems that perfection is attained not when there is nothing more to add, but when there is nothing more to remove." [Antoine de Saint Exupéry]
So I decided to cut some features and voilà ! Everything starts to make sense.
Keep it simpleA good API must be easy to understand and remember: this can be obtained using short but descriptive names.
It is also important not to use an unusual calling scheme:
var x = Lib.executeFunc('foo', bar);better:
var x = Lib.foo(bar);
- object as function
- signature polymorphism
I hope this article will be useful.
The new version of occamsrazor.js is on github