Why Your Algorithms Class Shouldn't Involve Coding
Lorin Achey
AI/ML for Robot/AV Perception | PhD Student | Lifelong learner with a "can-do" attitude and a passion for the outdoors
I know what the Computer Science folks out there are thinking. I mean, you want to be programming. You want to be living, breathing, and sleeping code. What the heck am I going on about with an algorithms class that doesn't have any coding? Before you start leaving comments and sending me messages telling me I'm nuts, give me a chance to explain. I just might convince you.
It was the first week of classes for the fall semester, and I was just starting to think about those first few homework assignments that had been posted. I figured I'd start on my Algorithms homework first because that would probably involve some complex coding that would take me a while to think through and analyze. We had started off lectures with run-time analysis, so I assumed there would be some questions about coding up a few sorting algorithms and analyzing the run-time. I opened the assignment sheet and was shocked to see that there wasn't a single coding question on there. I was so puzzled I actually checked to make sure I was in the right class! There were 5-6 problems assigned, each of which required a hand written answer. The directions were clear. Absolutely no pseudo-code was the message. No code of any kind. Our answers had to be in "plain English". The panic started to set in.
From the very first homework to the final question of the final exam, I struggled. Throughout the class, I just kept wondering why I was having such a hard time coming up with "solutions" to the problems presented in the homework and on exams. I started a GroupMe for my classmates and posted on the class Piazza so that we could all get together and work through problems together. Strength in numbers, right?
What became clear to me as the class progressed, was that all of us were stuck in this mindset of coding. We approached every problem as though we needed to code it there on the spot. This meant reverting to our preferred programming language and our preferred style. We fell back into habits and patterns that had gotten us through our introductory CS courses, including the brutal Data Structures & Algorithms class we take in the first part of our degree. We were beholden to the programming languages we had learned and the ways those languages are used to solve problems. We struggled with every problem to describe the solution in plain English because we were trying to get a solution with working code. Once I realized that this was my problem too, I started changing my approach.
I realized that I had to forget about coding and forget about programming languages. Rather than thinking about how I would solve the problem using Java's data structures, I had to think about how to solve it without a predefined data structure. I had to take every single proposed algorithm I came up with as a solution, and dissect it to pieces. Every step had to be described so that someone with no understanding of code could process it. I struggled through every darned problem in the homework, every exam problem, and all of the extra problems I looked up on my own to test my understanding. I don't think I got a single one right on the first try. But here's what I learned:
- When you put your mind to it and you spend time struggling with it, you can get a solution. Don't be discouraged.
- Programming languages have rules and restrictions. When you try to apply a language to your problem, you apply the same restrictions to your potential solutions. For better or worse.
- Algorithms is not about using code to solve your problem. It's about using your brain to do it. Once you can write the steps of your algorithm in plain English (or whatever language you think in), the code will flow seamlessly.
I grew tremendously as a software engineer by taking this Algorithms course, and I didn't write a single line of code. I fought with this material for the entire semester, but it helped me grow. My mindset and my approach to solving problems has changed. My ability to understand the objectives of an algorithm has drastically improved. I understand how the constraints of the problem will shape a potential solution. I am able to think, analyze, design solutions, and iterate on those solutions in a way I never did before.
As I worked through the last problem on my final exam today, I felt relieved. I read the problem, understood the problem, crafted an approach, worked through my own example cases, and wrote that darn solution out in plain English. I smiled to myself when I handed in my exam. Even if I don't get that A that I want so badly, I still have a personal victory, a personal win. I left that final exam a completely different person than when I started the class in August. Everyone in this field deserves a shot at shaping their minds to become critical, analytical thinkers, who can tackle anything put before them regardless of the programming language skills or tools they have at that time. Sometimes it takes being forced out of our comfort zone to really grow and this is exactly why I think your Algorithms class shouldn't be about coding.