Experience with d3.js – Bram
Most of what Geert said is true:
- Chaining rocks! I’ve noticed this already when writing PHP with ZF2, which also allows chaining of methods. Writing “obj.method().method2();” is way shorter than “obj.method(); obj.method2();”. There is, however, a downside. If I run “obj.method().method2()”, who’s to say what the type of the return value of “obj.method()” is? Is it obj itself (this is how ZF2 uses chaining) or is it an entirely other object? d3.js uses the latter aproach, which can be confusing in my opinion.
As I am writing most of my work in (derivatives of) C and/org Java, I’m used to strong typing. This way of working with functions took a time to fully understand.