Growing Past the Plateaus

Javascript Code

I’m fascinated by the process of learning. Since the end of my college days in the Eighties, I’ve taught myself a number of things, and I’ve learned a bit about the process. I’m especially intrigued by the process of plateau followed by progress, slowly climbing a ladder of comprehension as I dive deeper into a subject.

It was easy to see that process as I was learning to play the bass guitar over the last six years. When I first bought a bass, I already understood music theory. I knew how the notes I was playing (or trying to play) fit into a song’s overall harmony and I understood the function of rhythm. But that knowledge was a far cry from playing a favorite bass line without missing a beat or a note. I’ve come a long way from those first painful-sounding notes. I’m no virtuoso today, but I can hold my own. And I love it.

The process hasn’t been quick. Over the years, I’ve hit many plateaus. These are times when I would continue to practice, but not seem to improve. Frustrating. And sometimes I’d give up for a couple of days. Then, when I picked up the bass again, I discovered that I’d been able to move on. I could nail the passages that were too difficult to master only a few days earlier. Progress after the plateau. 

And it’s always the same. I’m working now to master my coding skills with Javascript. I’ve been coding as a hobby for nearly forty years, starting with BASIC when I first got a Timex-Sinclair 1000 in 1982. Since then, I’ve learned a number of languages to some degree or another, including Pascal, Visual Basic, Java, C#, and Javascript. My current focus is Javascript, and once again, I’m seeing the plateaus and the progress.

My most recent plateau involved incorporating modules into the code for my Eclipse Phase website. I had been creating a new script file for each system I wanted to incorporate. It’s a practice I’d learned with other languages, and I find it a lot easier to manage multiple, shorter script files than one enormous file. One function, creating random names from a database of hundreds of possibilities in more than twenty languages resulted in a very large script file. Including the random name function, and everything else, into one script file, just felt overwhelming. Even with bookmarks, finding the code I wanted to work on was a daunting thought. But, Javascript doesn’t necessarily work well with so many script files. 

What to do? My solution seemed to lie in using modules. In Javascript, modules are script files that can share their functions and variables with other scripts. Okay, I thought, that’s what I want. I can separate out my random names code simply share the randomName() function with the other scripts that need it. What I didn’t know was that modules impose ‘strict mode’ on the code. 

Javascript CodeIt’s important to note that learning on your own means you can’t just raise your hand to get an answer to a question. I’m relying on a few books and a lot of google-foo to get the answers I want. It’s often a pain. I can ask Google anything I want, but Google only responds with what it thinks the answer to my actual question might be. So when I modularized my code, it took me a couple of days to figure out that ‘strict mode’ didn’t like some of the ways I was doing things. And after all the work I’d done to get the site working, I felt deeply frustrated. Functions that had worked before now showed up as ‘undefined’ and buttons necessary for the site no longer worked. 

So, I had to learn another way to achieve my goals. When I couldn’t find an answer, I posted a question on Stack Overflow. Within a few hours, I had my answer. I had no idea that using onclick in HTML was considered bad form! But now, instead of onclick’s, I started using .addEventListener. Hurdle overcome,  I’m moving ahead with my project and anticipating the next challenge. Bring it on, Javascript, bring it on.

Author: Michael W. Bay

Michael is a geek. He likes smart science-fiction, good coffee, playing the bass guitar, making up songs in the shower, cats and dogs and a nice, long Stephen King novel.