code

Finding Code Inspiration, Before You Learn To Code


Last week,  I talked about the difficulty of finding a cool code project to care about if you didn’t already know how to code. Because of that, I’m trying to think of things that inspired me even before I knew how to write the code for them.

Maybe I’m not an adequate code evangelist. I cannot in good conscience tell you every site I visit makes me want to code. I often see a cool UI feature I like, for example, but that’s not quite the epiphany I’m looking for here, because appreciating it presumes a fair amount of coding knowledge already.

On occasion, though, I’ve run accross truly inspirational code projects, such as Tom Scott’s Star Wars Weather:

weather

How does this site work? By means of a pretty important code concept: the API, the thing that offers a site’s most important data in a format easily consumed by another website. A lot of weather sites have APIs, for example, and so you can find all sorts of tutorials on how to scrape weather data and display it on your site. Here’s the rub: I don’t care about the weather, let alone its API, and I have no interest in displaying it on my site. So these tutorials always left me cold. (ba-dum-bump!)

But then I saw Star Wars Weather, and I realized that it was doing a hilarious thing with the data I had previously spurned. The site’s default is London, but if you enter a city name and the code fetches the weather data for that city. Then it uses another program to match weather data with a Star Wars planet. You can also use Javascript to toggle between Celsius and Fahrenheit, and turn on geolocation if you want. Code, doing stuff! And if you like that, you might also like Dogeweather.com.

The second inspiration I remembered was more recent: Darius Kazemi‘s “You Must Be” generator.

It’s all the rage to use Markov chains to auto-generate text, especially on Twitter. Markov-generated speech also leaves me cold, probably because it’s only funny on a statistically random basis. But, as it turns out, you can do far cooler things if you structure the language with some sense of grammar. Enter “You Must Be”, which uses the Wordnik dictionary API to grab a word and its definition, then insert them into a classic pickup line, Mad-Libs style.

That’s quite a nice way to create a consistently performing joke structure, which explains why I’m so into the idea. Let’s face it, humor continues to be the thing I care about most in the world, and I now aspire to build my own joke bot someday, probably using some Natural Language Processing, which I also didn’t care about before seeing this example.

In both these cases, I had the definite feeling of “Damn, I wish I’d built that!” followed rapidly by, “Damn, I bet I could!” That’s why I’ve chosen them as the experiences I would wish for anyone who doesn’t have an idea yet, and wants a coding goal.

Some lessons I’ve learned from these moments if inspiration:

1) You don’t have to care about code. Let me repeat that: you DO NOT have to lovvvvvve Javascript or Python or APIs or data.  Don’t ever let anyone make you feel bad if you don’t. It’s fine to love code for what it can do, not what it is.

2) Don’t let anyone else tell you what’s inspirational. Should I be inspired by sites that help underprivileged children? Probably. Am I? No. And I’m not going to lie to myself about it. I’m a smartass. I like jokes. I’m interested in things that help me make more and better jokes.

3) Like all creative acts, code isn’t about doing things from scratch. It’s about combining heretofore uncombined things. The people who built these cool sites didn’t come up with entirely new code pattern, they used a pretty standard technique (reading data from APIs) and found a way to make the results interesting. But that’s really what you need to learn to code: a sense of the results you’d like to get for yourself, and a sense of the tools available.