Dev Talk Monday is the series that brings you awesome dev talks every Monday
Gooood Monday Vietnaaaam!! :)
Today I bring you a super duper awesome talk from the mighty Douglas Crockford during nordicjs in which he talks about his favorite (and least favorite) features of the upcoming ES 6 Harmony, and how the programming languages of the future may look like.
There is a ton of interesting things in this talk and I wholeheartedly recommend you to watch it not only in order to learn new stuff but for the sheer entertainment of it. Douglas is hilarious as usual. These were my favorite things from the talk:
Much like the params keyword in C#, ES6 will provide the new ellipsis (rest, spread) notation which will bring a real
Array typed variable to handle a varying number of arguments (goodbye old arguments variable):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
The let keyword which provides block scope to variables (as opposed to function scope), and which will allow destructuring when initializing variables:
1 2 3 4
Then Douglas starts discussing about the new class keyword and syntax, about object oriented programming, prototypical inheritance and finally comes to a very interesting way of doing OOP through object composition and class-free object oriented programming.
Back to object composition and class-free inheritance. The reasoning goes like this: In class based programming languages you need to create a taxonomy for the different types of objects in your domain, and normally you do this when you know the least about your domain. This means that you are going to do your taxonomy wrong, the wrongness is going to propagate from base to derived classes, you are going to need to fix it, refactor your code and it’s going to be costly. As it turns out, if you throw away classes these problems go away. Then he talks about prototypical inheritance, where objects inherit from objects – prototypes – instead of classes. The main reason to use prototypical inheritance being memory conservation, and this no longer being an issue today, we get to class-free OOP. Thought provoking… XD.
Check this out:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
I would swear that this still produces a taxonomy, albeit much more flexible, but perhaps I haven’t arrived to the uber enlightment level yet. It does fix the problems with this an new though.
And I think that’s enough, go watch the talk itself! :)