Functional-Light JavaScript, v3


Kyle Simpson

Kyle Simpson

You Don't Know JS
Functional-Light JavaScript, v3

Check out a free preview of the full Functional-Light JavaScript, v3 course

The "Introduction" Lesson is part of the full, Functional-Light JavaScript, v3 course featured in this preview video. Here's what you'd learn in this lesson:

Kyle introduces the course on functional programming in JavaScript and explains motivations for creating the course.


Transcript from the "Introduction" Lesson

>> Kyle Simpson: Welcome to version three of this workshop. I'm excited about the updates that we're going to have in Functional-Light JavaScript. We're going to be talking over the course of the next two days about functional programming, what that means, how to restructure our brains, because it is a very different way of thinking.

We have to restructure our brains to think about and try to solve problems in a different way. And if you have never done functional programming before, don't worry, we're going to go from the very basics. If you've done functional programming before, you should be aware that this is not exactly functional programming with the little trademark next to it.

It's my brand of functional programming that I call Functional-Light, that's where this name comes from. So, this is the name of this course, it's also the name of the companion book of the same name, Functional-Light JavaScript. So, if you are looking for somewhere to go from here, somewhere to dig into more of the concepts, or to get more of the background on something.

If we go too quickly through something and you need to go back and review, I strongly recommend digging through that book. Fair warning, even though it says light in the title, both in this course and in the book, it is not an intro beginner, light and easy sort of a course.

What we mean by light, it's not deep. And actually we are going to go pretty deep into these topics. But rather, what I mean by light is that we're not trying to inundate you with terminology, mathematic notation, which is what I would call the top-down approach to teaching functional programming.

And I don't know what your experience may have been, trying to be exposed to materials, books, blogs, talks, courses on functional programming. But I've been doing this programming thing for a long time, I'm now probably 25ish years into programming. And almost all of that has been in JavaScript, or at least aware of and familiar with JavaScript.

And I have gone to countless talks, read countless blog posts, tried to pick up and read the first chapter of I don't even know how many books on the topic of functional programming. And it always seems to me like the first couple of paragraphs are like, yeah, I'm tracking with this, I get this.

And then all of a sudden, they throw a word in like a monad or something like that. They'll throw a word in like that. And I'm immediately, because those words don't mean anything in the English language, I'm immediately out of context. Some of you may have that same experience, where you feel like, wait a minute, I was tracking and then all of a sudden we just went completely off the rails.

Not a little bit at a time, but just entirely off the rails. Or maybe it's not a term, but maybe it's some sort of mathematic equation, or they talk about something like category theory or something like that, and immediately, I'm off the rails, I'm losing track of what's happening.

So by the first 10 or 15 minutes of every functional talk I've ever been to, my eyes have glazed over, and I'm just barely keeping up, if even that. So maybe that's your story, and it certainly has been my story. It's felt to me like running face first into the side of a cliff wall of a mountain, where I kept wanting to, I was motivated, and motivation wasn't the problem.

I kept wanting to understand what this functional thing was all about. I remember, actually, probably more than 20 years ago, I remember hearing someone. And that would have been early on in my programming career, so I certainly wouldn't have had any sense of what the gravitas, what the meaning of this would have been.

But I remember hearing somebody saying something like blah, blah, blah, functional programming. And I remember thinking to myself, I'm good with that because I use functions. And it turns out that I didn't know anything at all about what I was doing there. That it turns out that the idea of having a keyword in your program called function, that's not enough.

So I decided to write this book, and I decided to build this course. Because for me, all of the existing materials, while completely valid and totally right, I have absolutely no critique of them. Other than, for whatever reason, they didn't work with the way that my brain approached things.

They didn't align with my background. And I felt inferior about that, by the way, because I do have a CS degree. I have a background in computer science, and I took a lot of math courses. And so, it's particularly pronounced that I feel inferior when somebody says well, it's just math.

And I'm like, well, I'm pretty good at math and I still don't get it. And the reason this course is called Functional-Light JavaScript, the reason the book is called that is because I wanted to take, rather than the top-down approach, a bottom-up approach. Speaking of the mountain, the cliff face that I kept running into and feeling inferior.

Feeling like I just somehow wasn't good enough, that I was dumb or that something was wrong with me. I kept having people say to me, well, it's great and it's amazing and it's awesome. And I'm like, the problem is not my motivation. I know smart people that know functional programming, and I totally agree with them that it would be great for me to know functional programming.

The problem is the path. And actually the problem is not even the path, the problem is even more fundamental than that. It's like if you walked up to, I don't know if any of you are rock climbers, earlier in my life, let's say, I did some rock climbing.

I am definitely not a rock climber at this point, okay? But I liked the idea of rock climbing, I would love to just be one of those people that could zip up the wall. I watched this documentary the other day, and this guy's like doing this speed racing up the rock climbing or whatever.

I'd love to do that, but that's not me, okay? I'm not a rock climber, but I can imagine the moment walking up to the cliff wall or a rock climbing wall in your favorite gym. And somebody who is very experienced in it, who's already up on the wall, up near the top, yelling down at you, just go ahead and grab that equipment and you can climb right on up.

And they point to this pile of equipment sitting on the ground. And that's what it's felt like to me with functional programming, is that we start talking about things that make sense to me. And then all of a sudden they say, and by the way, the carabiner, or and by the way, this such and such not on the rope, or they start using things as if I already know what they are.

They start using those terms as if I already know what they are, or they use a process to describe those things, that they're assuming that process is already familiar to me. And that's where I get lost, and it would be the same thing if somebody tried as an experienced rope climber, to explain to me the very basics of what on earth is this metal loop for?

That I happen to know is called a carabiner. What is that for? What does it do? How does it work? What are its properties and characteristics? Because what I can imagine is for the most experienced of the rock climbers out there, they are so far beyond the idea of what is a carabiner?

That they have forgotten what it was like when they didn't know what a carabiner was. And I don't know if any of you have ever had this experience with something else that you have learned. You're all excellent professionals at what you do and you probably have at some time or another, tried to explain to somebody else something that you're pretty good at.

I get to do that for a living and it's a particular joy. Because it forces me to come back to understand on a regular basis, just how easy it is to lose track, to lose empathy for someone who doesn't understand what you're saying. I do it all the time.

I use words, and then somebody looks at me weird, and I'm like, yeah, you don't know what that word means. Let me explain what that concept means, right? So it's a joy for me to continue to come back to that. To be confronted with and come back to those roots and ask those things.

It's been said that if you can't explain something to someone else, then you don't really understand it, but that doesn't fully encapsulate the truth. Because at some point, you can understand something so well that you may stop being able to explain it to someone else. Doug Crockford said it this way years ago, he said, the curse of the monad, and I'm gonna extrapolate that from monad, which is a crazy concept.

Which by the way, by the end of this course, we are gonna understand what a monad is. But, he's said the curse of the monad, which I'll extrapolate to functional programming in general, the curse of functional programming is that once you understand it, you stop being able to teach it.

And I've experienced that personally on many occasions, seeing people who write these fantastic things. And I know they know what they're talking about. It's not a question of, like, credential. It's not a question, like they're an idiot. They're smart people, and they know what they're talking about. But the way that they presented is from the top-down, with the assumption that you already have all of that training and background.

And so they can use something like the word carabiner, and you know what that means. I didn't know what a carabiner meant, and I didn't know what a rope knot looked like. And so I kept not benefiting from that material. So this book and this course are my attempt to give you a ground-up perspective.

Again, it's not a beginner intro. This is deep, heady, difficult stuff. And it's stuff that I still wrestle with, I am still challenging with. So I'm not here to tell you, I'm a functional programmer, okay? I have not arrived at the top of the mountain and now I have all the clarity and I can see everything.

This is still a daily struggle that I am trying to understand these concepts, and use them more effectively in my code. And I decided to write it down, so that hopefully other people might benefit from my exploration, my journey of learning. That's what this course is about.

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