The book "JavaScript: The Good Parts" is not one I've read. I had thought that there was also a "Bad Parts" book too, but I can't find it in Googling for it. I mention good parts and bad parts because, if recall correctly, Kyle Simpson mentioned the good/bad divide at this tech talk and suggested that if you're going to do JavaScript that you shouldn't really see it in terms of good parts and bad parts, but instead you have to know all of it and warm up to all of it. It was at this event that Mr. Simpson also gave out copies of books he had penned and I picked up one called "this & OBJECT PROTOTYPES" which I finished today. You can absolutely see his love for both good and bad in his book. The biggest criticism I would make of the book is that half of the book is spent convincing you that faking "classes" is unhealthy, but that is the sort of criticism I would make because I recoil from the bad parts. I didn't want to read about all the fringe conditions for dirtiness in classes, but maybe that just means I'm not a real JavaScript geek. The last book I read was the thousand page C# reference manual called "C# 4.0 in a Nutshell" and while I wasn't about to read a book that big again, there is another distinction to be made between reading of C# and reading of JavaScript. C# actually is awesome while JavaScript only appears awesome at a glance. The more I learn of C# the more I want to know. Not so with JavaScript. I'm babbling on a tangent. I suppose I've said the one ugly thing I have to say about the book and I'll let you decide whether or not it's legitimate derision. So what did I like about it? That's easier! The first half of the book is absolutely worth your time regardless of your level of commitment and the degree to which you hate the "bad" as it, the first half, is of the "good" and will have you learning new ways to do things you had not thought of. We get a comprehensive understanding of prototype as a keyword and, above all, some of the ways the this keyword may surprise you in changing shape and scope. The slipperiness of this will feel like playing with modeling clay more than the tedium of trying to jam a square peg in a round hole. You won't be thinking: "Oh no! I don't want to think about that." You'll be thinking... well, you can tell yourself that JavaScript is awesome until you get to the second half of the book. Your existing code where this is working won't cry out for a revisit. Instead there will be new possibilities in future dabblings. Don't stress. Here are some notes I took as I read the book:
- bolt properties onto a function
- bindings for this
- Array.prototype.slice.call()
- constructors
- currying with bind
- the spread operator and passing dummy objects for this
- fat arrow
- simple and complex primitives
- Object.assign
- Object.defineProperty
- .hasOwnProperty
- pseudopolymorphism
- how to name classes
- put a method on a function in JavaScript?
- __proto__
- OLOO
- duck typing
- class, constructor, super, extends
One last thing: Like the two other books I've namedropped above, this book is an O'Reilly book. However, "this & OBJECT PROTOTYPES" is the first O'Reilly book that I've seen that does not have a picture of an animal on the cover. Is that the new normal?
No comments:
Post a Comment