I disagree about call and apply though. I prefer to never use:
new
this (one exception)
Object.create
bind
call
apply
When I avoid this list my code tends to be smaller and faster to execute. You don't need OOP in this language, thanks to lexical scope, to achieve decomposable reuse and reference sharing.
The one exception for this is event handlers where it is commonly necessary to access the event target without access to an explicit reference.
This was exactly my thought process the whole time. There is an approach to object creation where you return an interface of the object, and it forces you to write amazing code, and it completely does away with new, this, Object, and bind. Call and Apply are solved by just being smart about how you pass objects around to functions.
On top of this, it lets you build objects in a way that each object only has EXACTLY what it needs to get it's job done, and absolutely no more. It's a completely different type of inheritance, and it works with JS so well.
-1
u/[deleted] Mar 09 '15
I disagree about call and apply though. I prefer to never use:
new
this (one exception)
Object.create
bind
call
apply
When I avoid this list my code tends to be smaller and faster to execute. You don't need OOP in this language, thanks to lexical scope, to achieve decomposable reuse and reference sharing.
The one exception for this is event handlers where it is commonly necessary to access the event target without access to an explicit reference.