This is a new series where I review a programming book I have read. I will usually issue a review within a few days of reading it. This one is late because I just decided to do this series.
First, let me say that I am a big fan of Kyle Simpson’s pragmatic teaching style. I read You Don’t Know JS: Up & Going a couple years ago and it changed my understanding of JavaScript at that time.
Since reading that book1 I have a more solid grasp on JavaScript fundamentals than ever before. I expected to learn something that I had been missing in learning those fundamentals and I did. However I was disappointed in Kyle’s dogmatism about const
, let
and var
and how and when to use them.
This was an issue in the first book as well. I understand some of the quirks when using syntactic sugar such as let
and const
especially when destructuring arrays. But we are far safer for them than we are without them.
Here is a bit of what I am talking about on this issue:
just realized a quirky limitation of let/const that doesn't apply to var:
— getify (@getify) October 4, 2018
var [ a = 1, a = 2 ] = foo() // ok
let [ b = 1, b = 2 ] = bar() // error
let c; [ c = 1, c = 2 ] = baz() // ok
This is a legitimate concern. But the conversation that followed made me question Kyle’s openness to new ideas:
i think you all overeached a bit in trying to save us from these "errors" -- which aren't actually errors. that kind of stuff is useful from opt-in linters. but the language shouldn't have been so opinionated. shrugs.
— getify (@getify) October 4, 2018
Opposing Viewpoints
Ben Lesh, who is a fantastic champion of RxJS and functional programming tweeted this:
Most respectable linters disallow var anyway. 🤔
— Ben Lesh 🧢🏋️♂️💻🎨 (@BenLesh) October 4, 2018
And I'm with @awbjs, const and let are saving us here, I've seen and even written this bug with var in my 20+ years. I guess I'm just not awesome. 🤷♂️
Admittedly, he could have avoided the passive aggressive jab at Kyle at the end but I agreed with this tweet.
JavaScript is a wild language that was written with some poor design choices. To ignore that fact is fatal; I don’t think you can teach someone fundamentals without pointing out these design choices that make JavaScript sometimes hard to work with.
JavaScript is a beautiful language. I enjoy writing it. And I learned more technical lessons about the language I love by reading this book. But, the concepts in the book are sometimes obfuscated by Kyle’s dogmatic insistence on old conventions. I don’t think he is aware how it comes across to people like me with intermediate skills trying to become more technical. It detracted from an otherwise crucial book to read when learning JS.
-
That’s the first in the series. ↩