February 13, 2020

Ben Popper is the worst coder in the world: Something awry with my array

Our intrepid new coder meets his first data structure. With an array of concepts in front of him, will he push his learning until it pops for him?
Avatar for Ben Popper
Director of Content

This is part 4 of an ongoing series detailing my journey from total noob to hobbyist coder. I share my thoughts as I learn the basics of programming. You can find the rest of the series here.

My StackCodes curriculum relies on FreeCodeCamp for lessons. I felt at least partly at home during the HTML and CSS lessons, having spent over a decade in the world of digital media. I’ve worked with TypePad, WordPress, Chorus, and several homebrew systems. When I was working at The Verge, we had regular discussions with the team making product tweaks to the software. 

When you’re going through the HTML and CSS, each lesson explains what the purpose of your code would be in a real-world application, and shows you how your code changes the website in real time, right in the browser. That all changes when you get to Javascript. I’ll give you an example. When you get to arrays in the FreeCodeCamp curriculum doesn’t explain how this data structure fits into the history of computer programming or how you might use it in a real world application today. You’re learning by rote in a vacuum. 

I was able to breeze through these array lessons without stumbling over any character errors, but I doubt I would retain the information very well, because I don’t have a clue what I’m building or why. When the course shifts to functions, there is no explanation of how that might be related to arrays. 

As it turns out, this is a common experience. As noted in a 2017 academic paper on the topic, “In the field of computing, data structures is a fundamental course that lays a critical foundation for the rest of the curriculum and is a solid basis for industry projects. A sound understanding of data structures, hence is indispensable for any student aiming to pursue a career in this field.” Ok, it’s important, but, “Data structures course is perceived to be a difficult subject for students, particularly the ones in high school because it is difficult for them to visualize how the data structures are structured and analyze its properties; hence they do not get the required motivation to pursue it in the way it should be.”

My sentiments exactly. Luckily, a little research turned up some options for a more engaging approach to learning about arrays. When you start teaching about optimizing time complexity in order to defeat the Nazis, I’m sitting up and paying attention! 

This Udemy course also helped. It uses the metaphor of a grocery store. You have an array of fruits. I can easily imagine how a computerized inventory system might go about tracking what produce was in stock based on bar codes entered by the cashier at the time of sale. 

In the 2017 paper I linked above, the authors suggest that music might be a useful tool for teaching students about data structures. 

“Muse can be considered as a practical application of this approach that teaches the operations on arrays and linked lists through music. There is a mapping between the musical notes and their corresponding tones (SouthCalMusic), (Do Re Mi Isn’t Just Child’s Play: How Solfege Training Can Improve Your Ear). This mapping is exploited for explaining the concepts of arrays and linked lists as shown in Table 1. The implication of this mapping is that different sequences of musical notes produce different tunes. Also, it is implicit that the various operations on arrays and linked lists of musical notes manipulate the sequence of notes differently. So, this difference in the sequences or the effect of the operations is brought out through different tunes. Hence, the similarity and the difference in the musical tunes is analogous to the difference in 803 arrays and linked lists.”

When I wrote my first column in this series, I said that I had an idealized vision of programming in my head, that it would change my brain In strange and unexpected ways. I’m still far from mastering even basic computers science, but I can feel my mind starting to discover new pathways, new frameworks and metaphors for thinking about life. From arranging musical notes to tracking fruit on a shelf, from allocating hours in my week to exercise versus family time, or organizing the editorial calendar here at Stack Overflow, arrays seem to be everywhere. Like the Fibonacci sequence, once you start to understand it, you start to see it everywhere in nature, a hidden layer of structure that was around you all the time. 

Our 2020 Developer Survey is open. We want to hear from everyone who codes. Professional or hobbyist, Stack Overflow user or not, share your thoughts with us so we can get a picture of the world’s programmers.

Tags: , , ,
Podcast logo The Stack Overflow Podcast is a weekly conversation about working in software development, learning to code, and the art and culture of computer programming.

Related

code-for-a-living February 27, 2020

The eight factors of happiness for developers

I recently came across this sketchnote by Tanmay Vora, and it really resonated with me. As a developer it got me thinking about how this might translate into the life of a developer and our happiness. Based on this sketchnote here are the eight factors of happiness applied to developer life. 1. Resentment Harboring resentment…
Photo by Dakota Roos on Unsplash
code-for-a-living February 3, 2020

Does your web app need a front-end framework?

You’ve likely heard about front-end frameworks. Names like React, Vue, and Angular abound in tutorials and Hacker News debates. If you’ve wondered why and when these frameworks are used and whether it’s time you implement one in your project, you’re not alone. A few years ago, while working on a side project, Hackterms, my own…
Avatar for Max Pekarsky
Software Engineer