Tales from a JavaScript Novice

18 Jan 2019

Initial thoughts on JavaScript

Java is the first language that I ever learned to program in and after spending a year with it, I learned C in my program structure class. The less amount of writing was a relief compared to Java even with the downside of coming up with make files for each assignment and less explicit error messages. Working with JavaScript gave me the same feeling of relief from switching from Java to C because once learning about how to declare objects in JavaScript, my immediate reaction was “That’s it?”. However, I’m so used to having to declare datatypes for function input and even though having to check that an input is the right type (e.g. strict-equality) is easy enough to do, it could potentially cause problems in the future if that step is missed. That being said, JavaScript looks like a powerful tool for software engineering because there are many options available (e.g. adding elements of any type to an array).

Practice, practice, practice

So, onto my first experiences making programs in JavaScript. For context, these practice programs were assigned as part of a pedagogy that utilizes timed, frequent coding exercises called WODs (Workout of the Day). The first piece was a pretty easy practice assignment to write a function that returns the sum of the multiple of three or five below a number. My first attempt clocked in at 4:32.89 and my second attempt was 1:07.93 with the latter just seeing how quickly I could type out the solution again. Feeling confident, I decided to try out the second practice assignment. This piece was a function that returned the sum of the even Fibonacci numbers below a limit. Sounds pretty simple, right? Well…on my first try, I went over 12 minutes and didn’t even figure out the solution. I tried to be “clever” but somehow ended up writing a loop that returned powers of two. After that, I decided to look at my professor’s solution video and after just a few seconds, I realized what I was supposed to do. I don’t know how I forgot what Fibonacci numbers were but I retried the assignment two more times, the second attempt taking 2:53.78 and the third attempt taking 2:33.21.

Now, for the REAL test

On top of doing practice WODs, we also have partnered and graded WODs. I thought I would get partnered with a JavaScript wizard for my first partnered WOD and even though we’re supposed to synchronously write every line, I would be shamed for my lack of knowledge. Turns out, my partner and I shared a very similar approach to the problem and communicating our understanding of JavaScript (and lack thereof), we were able complete the program without complication. Two days later, we had the graded WOD, which is functionally the same as the practice WODs. Taking into account the lessons learned doing these exercises multiple times made the graded WOD a breeze and solidified my enjoyment of timed programming exercises. Of course, there will be times when I simply can’t remember basic concepts or functions but I’m still just starting out with this and I’ll get better with time.