Deep JavaScript Foundations, v3

Understanding Features

Kyle Simpson

Kyle Simpson

You Don't Know JS
Deep JavaScript Foundations, v3

Check out a free preview of the full Deep JavaScript Foundations, v3 course

The "Understanding Features" Lesson is part of the full, Deep JavaScript Foundations, v3 course featured in this preview video. Here's what you'd learn in this lesson:

Kyle argues it is a better approach to seek understanding of JavaScript features than to avoid them.


Transcript from the "Understanding Features" Lesson

>> Kyle Simpson: Doug Crockford famously said, iif a feature is sometimes useful and sometimes dangerous, and if there's a better option, then always use the better option. As a matter of fact almost all of the good parts stems from this one foundational perspective. I respect what Doug has done for our industry, but I couldn't disagree more with this prospective.

Partially I disagree with this because we throw this principle around, and we don't even say what we mean by these words. So what is useful in what is dangerous, only what dog thinks is useful dangerous? Is there some universal definition for useful dangerous? How about better option? How do we define better option?

Is there some universal standard by which we measure better? The statement is not useful in its abstract sense. It's used in its abstract sense, but it's not useful. So, let me put my mark in the sand and tell you what I mean by those words, okay? Number one, useful is when the reader is focused on what's important, and dangerous is when the reader can't tell what's gonna happen.

And better is when the reader understands the code.
>> Kyle Simpson: So you could take that principle and apply the specific meaning to it, but you can't simply throw that sentence around as a justification for why you avoid learning an entire part of the language.
>> Kyle Simpson: The big crux here is, in Doug's opinion, there's a better option, which is just don't learn and understand types.

My perspective is that's not better at all, because it leads to developers systemically not understanding their code. It's not better because it leads to less understanding. The takeaway, I want you to get here is that it is irresponsible to knowingly avoid usage of a feature that can and does improve code readability.

It is not just simply, you're not taking advantage of some great things, you are actually making code worse off. Not only for your future self, but for all other people that need to read and maintain your code.
>> Kyle Simpson: That tool exists and it's irresponsible not to learn and use it.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now