I read all of https://github.com/getify/You-Dont-Know-JS to learn JS fundamental knowledge.
Appium is NodeJS powered project. I’m working as a member of the project.
I recently maintain Ruby, Python, Appium servers(including any drivers) mainly. Sometimes I step into .NET or another world.
To increase my commitment to the project, I must learn JS further since I’m not familiar with JS language…
Hense, I started learning https://github.com/getify/You-Dont-Know-JS to dive JS fundamental deeply.
Below is some note to me after reading the documentation. They are not all I learned from it. But I’d leave some of them here.
Class in JS
One interesting topic for me is the concept of class in the JS world. The class is a popular term in various programming languages.
We define an object as a software bundle of related state and behaviour. A class is the object in the programming world. An instance is a concrete item created from the object.
In general, we modify the state of the instance via methods provided by it after creating it. Kindly the class is an abstract model.
But in JS world, a class is instantiated into object form by a copy operation.
https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch4.md
The concept is similar to bing in Erlang/Elixir world in my knowledge. I heard by many guys a definition of class in JS differs from other OOP. I could understand the difference…
Mixin in JS is also interesting. They are just a link. The JS doesn’t copy it like a object.
https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch4.md#mixins
“Plainly, there are no “classes” in JavaScript to instantiate, only objects. And objects don’t get copied to other objects, they get linked together (more on that in Chapter 5).”
“Classes mean copies.” in JS WORLD
A class in ES6: https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch6.md#es6-class-sugar
JS says this linked based coding style as OLOO(objects-linked-to-other-objects).
I felt JS requires Engineers to choose how to implement something in JS… (Personally, this is very tough)
class does a very good job of pretending to fix the problems with the class/inheritance design pattern in JS. But it actually does the opposite: it hides many of the problems, and introduces other subtle but dangerous ones.
https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/apA.md
Class/Prototype in JS are unique…ah…
Symbols
I show a new item, Symbol, in ES6. First, I couldn’t understand why JS need the feature.
But I understand it is because for developers who have responsibility for JS engine. As a user who implements something using JS can implement something without Symbol explicitly.
Primitive
Note for primitive value.
Simple values (aka scalar primitives) are always assigned/passed by value-copy:
null,undefined,string,number,boolean, and ES6’ssymbol
https://github.com/getify/You-Dont-Know-JS/blob/master/types%20%26%20grammar/ch2.md
Yield
yield in JS is also a unique thing for me. It is like pause & re-run feature.
Conclusion
I believe I understand JS further than before by the documentation.
I could understand what was happening behind modern concept or syntax as prototype or object in vanilla JS.
For example, .next, .return, etc in Iteration. Promise feature.
I could also be able to imagine what was the difference between JS and other programming languages in general terms like object.
I hope this will improve my decision how to implement JS code following JS world…
1 Comment