The moment I realized I needed a CS Degree

A little more than two years ago, I was in London, UK and had just finished a 12-week hacker school. Rather than looking for a dev job during the course’s demo/graduation day (as is the norm at a hacker school), I was getting ready to move across the Atlantic to Vancouver, Canada to begin my Bachelor of Computer Science degree at the University of British Columbia. Here’s the story of when I realized a hacker school really wasn’t enough to get me where I wanted to go.

The story

It must have been something like Week 8 of the hacker school when I started thinking about applying for jobs and what my options would be at the end of it. I remember checking out a bunch of companies that used Rails in London and looking up sample interview questions on the careers section of their websites and Glassdoor. There were quite a few smaller independent firms that seemed open to hiring a hacker school grad, and their questions didn’t seem so bad.

At that point, I had just started to get comfortable with Sinatra and Rails and had probably built my first couple of web apps – a classifieds website for university students and a lowest unique auction site. And, as you do when you’ve just started to get the hang of a new field, I was thinking that I was getting pretty good – they call that the Dunning-Kruger Effect. I remember thinking that if things had worked out, I could have built a Facebook, I mean how hard could it be (building a scalable, secure and efficient system is hard as it turns out, and that’s ignoring the user acquisition and growth side of things).

But being the sensible person I am – I’m trying not to cringe as I write this post – I figured I should probably work there first. You know, get an idea of the finer points. Besides, I’d heard great things about the company from people who worked there. I’d even visited the office once before (the one at Page Mill Road I think) and it was pretty cool (free drinks, open plan office, Herman Miller chairs). So I checked out the careers section of their website and started trying to solve a sample engineering problem – back then Facebook had engineering challenges that you could solve to get contacted by a recruiter.

The sample challenge was to write a solution to the Tower of Hanoi.

Diagram of the Tower of Hanoi

Tower of Hanoi

As per Wikipedia, the objective of the puzzle is to move the entire stack of disks from one rod to another while obeying these rules

  1. Only one disk can be moved at a time.
  2. Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack i.e. a disk can only be moved if it is the uppermost disk on a stack.
  3. No disk may be placed on top of a smaller disk.

If I remember correctly, the aim of the puzzle was to generate a sequence of moves which solved the problem.

Come again?

Yep, I had no idea where to even begin – and this was the sample challenge. The one that was meant to give you an idea of how to handle input and output, rather than being representative of the difficulty of challenges since the real ones are always a lot harder than the illustrative examples.

I remember doing some research on the Tower of Hanoi and discovering that it had to do with something called recursion – I only had a vague idea of what that was at the time. Most importantly though, I found out that this was a well-known problem taught in pretty much all CS degrees as part of their introduction to algorithms and data structures.

The more I read about the topic, the more I realized I didn’t know. My brief moment of (over)confidence in my abilities quickly evaporated and I figured out that knowing how to build a web application in something like Rails is not the same as being a Software Engineer – that building an MVP of a social network site is not the same as engineering one. The former can be done by following Michael Hartl’s famous Rails tutorial, while the latter requires knowledge of computer science and algorithms, hardware, growth, marketing, data science, etc, if the app is to stand any chance of success.

Doing the hacker school was great for figuring out that coding for 8, 9, 10, 11, 12 hours a day was something I really enjoyed, but most importantly, for learning how much more I still had to learn if I wanted to tackle really complex problems with code.

And so I looked around for CS degrees that took students with a previous degree. There were a couple of Master’s programs in the UK which seemed ok but a bit too short; most of them were only one year in duration and I didn’t think that was enough time to get a really thorough understanding of fundamental CS theories, plus they didn’t seem to have the top-tier tech companies recruiting from there.

The top CS schools in the US on the other hand, generally didn’t offer second degree programs. Some, like Stanford, didn’t admit students for second Bachelor’s degrees at all, while others like Waterloo required students to start from scratch and do a 4 year program.

And then I found out about the Bachelor of Computer Science (BCS) program at the University of British Columbia in Vancouver. It checked all the right boxes. It was shorter than a regular CS degree but not that short (advertised as 2 years, but 2.5-3 years in practice) and had good links to American tech companies (Facebook, Google, Amazon and Microsoft recruited its students) and had a decent reputation (something like 30 to 60 in World Rankings if you buy that sort of thing). And before I knew it, I was on a plane to Vancouver, Canada.

And that’s it. That’s how I ended up studying for a CS degree and how I kind of went full-circle this summer interning at Facebook – something I am certain I could not have done with just my experience at a hacker school, not by a long shot. It’s also been a while since I solved the Tower of Hanoi.

Here’s the code I wrote for it during my intro to algorithms class in my first year of my CS program – it’s probably a little rough around the edges but I remember thinking at the time I wrote it and solved the problem, wow, I’m really getting somewhere.

 

#include <iostream>
#include <string>

using namespace std;

void moveDisks(int, string, string, string);

int main(int argc, char* argv[])
{
  if( argc != 2 ) {
    cerr << "Usage: " << argv[0] << " n" << endl;
    return -1;
  }

  int n = atoi(argv[1]);
  moveDisks(n, "A", "B", "C");
  return 0;
}

void moveDisks(int n, string from, string transition, string to)
{
  if(n == 1)
    cout << "Move disk from peg " + from + " to peg " + to << endl;
  else {
    moveDisks(n-1, from, to, transition);
    cout << "Move disk from peg " + from + " to peg " + to << endl;
    moveDisks(n-1, transition, from, to);
  }
}

Leave a comment