(Hacker School: Week 5, Day 5. Fair warning, this one's pretty technical.)

Here I am, it's the fifth day of the fifth week of Hacker School. I haven't written a post in a week - out of laziness, maybe; out of a desire to code instead of write, oh most definitely1. That's been the value of this week - writing code on my own (as opposed to from tutorials or books).

Damn Hard

A friend sent me a great post the other day that encapsulates much of what has been so strange, and newly frustrating, about learning how to program (mostly) on my own. It's worth a read, especially if you've been learning on your own - you'll just nod your head a lot - but the author's point is that learning to code on your own is hard (damn hard). It's probably not unique in that respect (I can't speak to other disciplines); but, the author speaks well to the particular difficulties I've encountered so far. In the beginning, my learning was certainly characterized by an initial rush of understanding - I know how to write Python! - and a subsequent drop of confidence - I have no idea what to do with Python! It's an empty feeling - I know something, but I don't know what to do with that knowledge. And it began to erode my confidence.

So in my time off between work and Hacker School, I learned how to build apps/sites in Django and in Meteor - big web frameworks that aren't exactly beginner-friendly. I shot for the moon, and missed, but landed in like, George Clooney territory, not among the stars.2 That is, I got something to work! And had no idea how it worked. 

Is that useful - to get something done, have something to show, but not know how it happened? Hacker School doesn't think so - and I don't either. I think it's much more important to understand something - especially something as complex as a web app - from the ground up.3

The Fundamentals

And that's what I've been focusing on here - learning why and how something works. But it's time-consuming, often confusing, and there's not always something visible to show for it. So this week has been especially interesting in being mostly spent on two very different projects.

The first project is a small web framework, written in Python. I've been working alongside a fellow Hacker Schooler, Paul, and we've been building similar but separate frameworks. We spent much of the week digging as deeply as possible into how to build a web application in Python from scratch. And we've learned a lot - about how the internet works, how and why simple web frameworks (like Bottle and Flask) do what they do, and how to handle seemingly simple things like HTTP requests. It's fascinating, fun, and often frustrating to build something from scratch - it's helped me to appreciate the people who have spent their time making sure 99.5% of us never have to think about things like HTTP requests or URLs. But at the same time, here's my visible progress thus far:


image

4


But is visible progress even important? Would I learn more if I actually built something - something that does more than allows me to type in my name and favorite movie and shows a lame, code-esque representation of exactly what I typed in?

Overcoming 'Fear'5

My second project came to me late Wednesday afternoon. I've been wanting to use the Rotten Tomatoes API - Rotten Tomatoes is a movie review aggregation site, so naturally I wanted to use it - but had been legitimately scared off because I couldn't conceptualize how it would work. Most simply, I was scared of the word (acronym) API. Programmers around me have used 'API' to describe so many seemingly unrelated things that it became almost impossible for me to wrap my head around what it meant concretely. But in keeping with the spirit of Hacker School, I was determined to confront that fear. Here's a great passage from HS's manual (linked above):

Another obstacle we try to remove is fear. We think this is one of the most pernicious impediments to education. In most of the world, but especially school and work, people are afraid of looking stupid. This fear frequently keeps us from asking important questions like "how does that work?" or even just "why?" Worse, it keeps us from saying "I don't understand." That means many of us muddle on with a half-baked or entirely incorrect understanding of core concepts. This is particularly bad with programming, because these misunderstandings compound, and over time become harder and more embarrassing to admit to and address.

So I pressed forward to find out how it worked. And as it turned out, there was nothing to be scared of - it entirely depends on the API, but the one given by Rotten Tomatoes is easy to use if you have some understanding of URLs and working with JSON data (if you don't, that's ok too! It takes some time to learn but is at least pretty intuitive). The basic concept is you, as a developer, get a key from them - this tells them you're not a robot, essentially - and then you can access a certain amount of data in a predefined format (JSON) using predefined queries/parameters - like a movie you want to search for, or a specific data set like upcoming movies (in the form of URLs). And then you can do what you want with that data. So here's what I did!

image

I made a command line interface! It's not done yet - you can't actually access all of those things (well, you can't access any of them yet, only I can) - but I've made good progress. It's less cool-looking than a fully-functional web app - but also a lot easier to make, and thus a lot less frustrating. It was an easy win for me, got me motivated about building something on my own, and was fun to do - all a great contrast to something more esoteric like building a web framework.

More importantly, let's search for a movie - 'batman'!!!

image

I don't care about The Dark Knight6 - let's get more info on Batman & Robin!

image

So 'more info' just means small snippets of reviews for now - but it's something. And hey, you can easily see who hated and loved Batman & Robin! (Answer: everyone hated it except the Times, inexplicably. And 'wounded yeti' could stand to be part of the lexicon over, like, selfie.)

In conclusion: it's a valuable struggle to build something from scratch - I for one have learned a lot so far from the experience of building a web framework. At the same time, I'd argue that it's extremely important when learning any skill - but especially something as broad and potentially overwhelming as programming - to work on small, doable, motivating projects applying some small portion of what's been learned so far. These allow for a mental breather - I don't have to learn a whole new concept - and help to actually solidify learning in a meaningful, lasting way. It was rejuvenating to build something quickly, easily, and with showable results - and in color! What a week.


1. If by some unfortunate accident you haven't watched Arrested Development do yourself a favor and stop reading this right now, come back in 25 hours when you're done, thanks.

2. I really wanted to clumsily work that overly inspirational quote in there somehow. 

3. Bold move, plugging your own blog in your blog.

4. No, I didn't watch The Social Network and get really inspired to go and learn programming. The Zuck of that movie is lonely and sad and Citizen-Kane-esque and I don't want to emulate it. It's just a great movie by a great director who can't stop making great movies. (And I just like programming.)

5. Not this Fear.

6. Lie.