Sean Says Stuff logo

Teaching JavaScript

JavaScript isn’t algebra, it’s not a matter of “If I just remember all the formulas, then I can apply them.”

These methods, fetch, querySelector, map, filter, they’re just TOOLS. They aren’t euations where you just plug things in and get the same results. “In order to make a program you combine A, B, and C, and VOILA! It’s an app!”

It’s more like having a saw, a hammer, a wrench, and you pick the proper tool for the task at hand. But, what you are building is entirely up to you. A saw always cuts, but you don’t always need a saw. Sometimes a hammer and nail will do, other times call for a screw and screwdriver, and depending on the task sometimes you need a SPECIFIC type of screw (wood, metal, etc…). You need to cut lumber down to a certain size, so you grab a saw. Do you choose a hand saw, band saw, circular saw?

So, sometimes you need to get external data. You might reach for fetch, but you’ve heard of this thing called XHR that fetch has more or less replaced, so that’s an option. Sometimes, you use getElementByID, or you just like to use querySelector, b/c it reminds you of working with selectors in CSS, and you think it’s easier to remember. You need to create elements, but you don’t know what kind until you get the data, and then you decide.

Sometimes you have an element to append everything too, other times all you have is a body. It depends on the situation at hand, and how big of a project you are building.

Sometimes you’re getting the weather, some times you’re getting Chuck Norris jokes, other times you’re getting health statistics.

You choose the tools that you think best fit the job at hand.

If we build a birdhouse in class, and I tell you that a doghouse is just a bigger birdhouse, then you should be able to take what we did with the birdhouse and use it to build a doghouse. Yet, some folks will freak out and think “I DON’T KNOW ANYTHING ABOUT DOGS OR DOGHOUSES!!” Look at the patterns, not the finished product. If you know the patterns for a birdhouse, and I said a doghouse is a bigger version, then look at what things they have in common.

From there you can move on to bigger and bigger projects, garages, houses, skyscrapers, as you get more comfortable USING these tools.

Right now, you are learning that these tools exist, the basics for how they work, and how to get started building something with them.

Fetching Chuck Norris quotes gives you skills to create charts showing COVID infection rates across the country.

It’s NOT “paint by numbers.” It’s predictable insofar as “I need to FETCH data” it’s not predictable like “a squared + b squared = c squared.”

MAKE SURE THE WORK YOU’RE DOING IS THE RIGHT WORK! Some of you are spinning your wheels, you’re putting in effort but you’re chasing the wrong “rabbits,” and you’re not moving ahead. Put in the RIGHT KIND OF TIME and SPEND YOUR ENERGY WISELY.

Write code, re-write code, and write it again. Solve the same problem multiple times, and see what you come up with.

Often, there isn’t a SINGLE “right” answer, there are multiple ways to end up at the same destination. Spend your time finding out those ways, not looking for answers, or jumping to the solution.

Photo by Ferenc Almasi on Unsplash