People should learn to code by making iOS apps

5/30/2013

Last week, along with my friend Pablo Quinteros, I led an Internet Week New York “Classroom Session” on how to build an iOS App.

We’re living in the early stages of the “Learn To Code Movement”. Training site Code Academy has raised millions in funding. Famous Bills like Bill Gates, Bill Clinton, and Will.I.Am have lent support to code.org. And while actor Jason Bateman stars in a revival of a TV series cancelled 7 years ago, his 47 year old sister Justine is working on her Computer Science degree at UCLA.

Although the movement itself is language agnostic, it’s most often that lessons are only available in JavaScript, jQuery, or a server language like Python or Ruby. It’s rare that iOS is mentioned as a starting point. But I believe that iOS is not only a great platform for aspiring programmers to learn how to code, it is the best platform for aspiring programmers to learn how to code.

The secret of getting ahead...

If getting started is the hardest part, then iOS wins out the gate thanks to Xcode. OS X ships with both Python and Ruby, but accomplishing Hello World in either involves Terminal, and learning how to navigate a UNIX command line. Xcode is a simple Mac App Store download, so Mac users will already know how to set it up.

When the download is complete and the first project created, the beginner doesn’t have to learn some arcane command to compile and another to run: they just click the huge Play button as they would in iTunes.

Oh, this old thing?

Even if a newcomer picks up Javascript in a day, they’ll still be limited to building things with Times New Roman on a white background. It doesn’t look good. But a new project in Xcode looks great on first run. The nav bar is curved at the top with a subtle shadow at the bottom. The font choices are sensible for mobile software. All of the great animations and graphics in UIKit are given to the programmer, for free.

You’ve got to hire a designer to really knock socks off in the App Store, but bare-bones UIKit has enough on its own to make for a sexy to-do list or time tracker. It’s easy for newcomers to stay motivated when the environment automatically makes everything look nice.

Lesson 1: Drag. Lesson 2: Drop.

Storyboards are an incredible tool and I have used them to ship the last several apps I’ve worked on. They aren’t perfect for all use cases, but debating whether or not they are good for experienced developers is not a point I want to argue here: they are absolutely fantastic for new developers. What could be simpler than Drag and Drop? And if one wants to tweak a UIButton, it’s just a checkbox or text field edit away. Of course not everything can be accomplished with Storyboards, but the paradigm encourages top-down thinking. It then feels natural to move on to filling in the blanks by providing UIViewController method implementations.

The web is still dead

Making a website just isn’t that exciting or interesting anymore. There are a number of services like SquareSpace, Tumblr, and Wordpress which can be used to build something that runs in a browser. When was the last time we saw a web app that blew us all away? Everything exciting is now happening in the App Store. People prefer to use apps, so it’s only natural to assume that they’d prefer to make apps as well. Learning how to build a cool app is a lot more fun than learning how to build a cool website.

The bad

Is Objective-C the easiest language to learn? No, just the nature of having syntax means a newcomer is going to fumble when beginning to edit source. But the verbosity of Cocoa Touch frameworks makes this easier to get a handle on - it’s clear what all of the required pieces are to make something like animateWithDuration:delay:options:animations:completion: do what it needs to do.

Also, accessibility is an issue. Not everybody owns an iOS device, and not everybody has a Mac. But those that do should learn to code by learning how to make iOS apps.