Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Node.js Best Practices. Parent comment
yeah,well one is still using new inside the constructor.
it's pretty obvious to me that :
1/ one should read the docs before using an api
2/ capitalized functions are meant to be used as constructors.
3/ If you dont like this pattern,write builders and make them obvious. like Object.create()
To me when i design js APIs, I have 2 kind of "templates" :
the jQuery "$(o).after(b).get(0)"/underscore "_(object).method().value()" monadic api style that wraps types (like promises)
OR
The way the DOM is built,more java-ish with builders everywhere ( document.createElement ... ).
So I hardly use new anymore.
I get that people might make mistake or like Python style OO;but still, I think forcing the "new" in unecessary.
There are no comments on this comment yet.
yeah,well one is still using new inside the constructor.
it's pretty obvious to me that :
1/ one should read the docs before using an api
2/ capitalized functions are meant to be used as constructors.
3/ If you dont like this pattern,write builders and make them obvious. like Object.create()
To me when i design js APIs, I have 2 kind of "templates" :
the jQuery "$(o).after(b).get(0)"/underscore "_(object).method().value()" monadic api style that wraps types (like promises)
OR
The way the DOM is built,more java-ish with builders everywhere ( document.createElement ... ).
So I hardly use new anymore.
I get that people might make mistake or like Python style OO;but still, I think forcing the "new" in unecessary.