Wait up for me, Javascript!

19 Jan 2022

Javascript: The Reigning Champion?

During the summer, my friend and I decided to do some Leetcode (a website that gives you problems to solve with code) problems together. At the time, the only languages I had been exposed to were Java, C, and C++. Since my most recent experience was with C (a more rudimental and “computery” language), I decided to code in it. On the other hand, my friend had just finished taking ICS 314 so he used Javascript. I remember peeking at his code and seeing statements like let num = 2; which sounded baffling to me; it sounded like you’re commanding these lines to allow themselves to exist in your code.

I didn’t think our different choices in language would make a difference but boy was I wrong. In the beginning, he would be finished with the problem while I was still there trying to figure out where my pointers (a location marker for things in the program–a bane of many people learning C) were located. Although in the end, my C programs were faster than his Javascript programs (an advantage of the C language), I was slowly recognizing the strength in using Javascript. Even when I pivoted to using Java for the Leetcode problems, there were just so many things that my friend could do in Javascript much more easily than I could in Java.

Fast forward a few semesters, I’m finally taking ICS 314 and after we did this tutorial, there are some new things I’ve picked up. For example, I finally understand that Javascript treats functions just like any data type (numbers, strings, objects, etc) aka it’s first-class. I’m also getting a better understanding of anonymous functions in that they’re just functions for one-time uses. However, I know that more hands-on experience will be needed for me to understand why/how they’re useful. Lastly, I’m so glad the tutorial included a section about promises because whenever I came upon this in the past, I had no idea what it did. Essentially, it allows your code to come upon a fork in the road and choose a path based on a certain condition.

After learning this much, in my opinion, Javascript is a good programming language from a software engineering perspective. I think so because its flexibility allows for creative programming and allows people to focus on the actual content of their program rather than the syntax.

Wake up! IT’S TIME TO DO A WOD

There’s something about seeing that timer go down that gets your blood flowing and your heart racing as you are doing a WOD (timed, pass-fail coding exercises). In this class we use an athletic software engineering learning approach and WODs are like reps and in this case, we’re exercising our Javascript skills. And a few days ago I did my first practice WOD and I definitely felt stressed out (but also worked out). In fact, I kept making mistakes during my WOD and kept forgetting syntax. However, once I got in the groove and started completing more WODs, it started becoming fun (when I actually solved the problem that is). There’s something so satisfying about coming up with the solution to a problem and then seeing it come to life with code. Having the timer can be terrifying but that fear has personally pushed me to study harder.

On the flip side though, I do feel like I’m not taking full advantage of what Javascript can do. Specifically, because I’m stressed, I’d much rather write code that I’m familiar with (e.g. if-else statements) rather than code that may be more accepted in Javascript (e.g. a ternary operator which is essentially a shorthand for conditionals). And to be honest, I’m usually a more think-it-through kind of person and enjoy spending time thinking about an algorithm then drawing it out to test it, so conducting WODs in this fashion is completely the opposite of what I do. But I know companies do this in real-life (“Please solve this problem within 30 minutes”), so I’m happy to exercise this skill, despite how stressful it is. As long as I take time to study and practice Javascript, I think athletic software engineering will go WODerfully.