A Boring Foundation in Vanilla JavaScript

Every semester there's that one kid who wants to learn React or Vue or something and is disappointed to hear me say that's not gonna happen in my class.

Photo by Christopher Robin Ebbinghaus on Unsplash

Every semester I have at least one student who takes my class and asks me why we're not learning a particular framework. It's a telling question because I know they're looking at job boards. They're not sure if what I'm teaching them is relevant. They're hearing about code schools that teach frameworks and are wondering how they're going to hold their own in the market. I usually fumble through some form of, "trust me this will help you in the future," but I never give the topic enough room to breathe. They accept my answer because 1) I'm the professor and 2) they're paying for this course and they want me to be right. So today I want to give this topic a bit more space to breathe.

What do They Learn and the Answer

My course, Advanced Web Technologies, has me teach students HTML, CSS and JavaScript. Not React, not Sass, not Webpack/Babel...regular old technologies. Boring technologies. Foundational technologies. You can divide the class into 3 parts: HTML/CSS, the JavaScript language, and working with the DOM.

First, we go through the basics: I make sure they understand HTML/CSS and what they are and a little history. Once I know they can build a basic page we dive deeper into Accessibility, flexbox and grids, and responsive design. History is important but I'm not going super-crazy with this, but I do want them to understand some basic differences between rendering engines and the history behind things like that. We're not delving into the <blink> tag lore or anything. Part 2 of the course is where I start digging into JavaScript. Some kids come to me knowing a lot, others not so much. I go into the course assuming they know nothing and teach it from there.

So it stands to reason that the argument against teaching frameworks is that I've got a rather diverse group of students some super-advanced others not. So how could I possibly teach frameworks? This "walk before we run," argument is usually the one I deploy, but it goes deeper for me.

History Repeating Itself

The real problem I have takes a bit of a lesson from history. I started writing JavaScript back when considering it "total shit" or a "toy language" made some sense. Remember, JavaScript runs on your users machine and that's fine today, but in 2002, well, things were different. JS solidified itself when AJAX started to come into the forefront. Now, before 2006 if you wanted to do AJAX there were some libraries like PrototypeJS, but you were writing a lot vanilla JavaScript yourself. After 2006 we had jQuery and that's still running on, like 70% of all websites. The best thing that jQuery did at the time was smooth over browser differences, it made it so much easier to code something that could run in different browsers.

I started to see the trend away from jQuery, I don't remember when, but sometime after 2013 for sure, I was out looking for a new job and I was getting questions like, "what is hoisting" and "explain scoping."

Total sidebar here but if you're not in the tech industry you may not realize how much of a programmers interview process is like a quiz in school. We deal with the normal, "so tell me about yourself" questions, but then also have to answer an array of questions about how to program and how we think about programming and if we really know the ins-and-outs of a couple of different technologies. It really is us answering made up questions on a whiteboard or doing some random programming assignment.

Nothing makes you feel like a bag of shit more than spending years writing code in a language only to be asked a basic-ish question and being unable to answer it! You start to question yourself, your abilities and your life-choices. So I lost out on more than a few opportunities because I didn't keep up with the language as much as I kept up with a single framework. The funny thing for me is that I did start out writing vanilla JavaScript, but I let those abilities atrophy while working in jQuery.

Now, I'm not blaming jQuery for my knowledge gaps. Life gets in the way of all developers and around the time that JS itself was maturing I started having kids so reading articles, learning new technologies for fun, keeping up to date, and working on side projects dropped to zero for a while. I don't regret my choices in this area, I was very good at what I could do and that allowed me to coast for a number of years...until I started to hit walls and boy did I hit 'em!

The Tl;DR for me is that I shored up my gaps and started learning again. Today, I'm comfortable writing Vue/React or vanilla JS among other things. I'm good. If this seems like I'm ranting or angry, I'm not. I get it and I see how I did it to myself, but this colors my teaching for sure.

Doomed to Repeat It

When my students want to learn React/Vue or those assorted technologies before they're "walking" I see myself in them. I love the excitement they feel about these technologies, but I see the pitfalls and hurdles because I hit them. I can't predict the future I can't predict how long React will be around, I'm sure its got a long life ahead, but it won't always be the new hotness and when trends shift I want my students to abe able to adapt with the times. My JS atrophied but there were others who never learned vanilla javascript and had to start from scratch. I refuse to let that happen to my students. I want my students to know enough to be able to use whatever a company throws at them today, tomorrow, or 10 years from now. The only way I can do that is by giving a boring foundation.

Walk

So I drill them on the basics and we come full circle to the "this will help you in the future" argument, but now with some more context. Also, it's important to know the basics may not be all that basic to everyone: I had a student go into a company as an intern and teach the dev team about CSS Grids because he was the only one who had used them before! (obligatory Maui "You're Welcome" gif) If you're a student of mine and you're frustrated I get it, but frustration at 20 is way better that frustration at 32 with a couple of kids—trust me on this one. :)

TL;DR

Fundamentals pay off eventually. They're not always fun or sexy but at the end of the day having a solid JS foundation allows you to move into new/hot/sexy frameworks in the future. Hell, the basics allow you to build your own frameworks! Here's to walking, not running, and starting at the beginning.