March 21, 2012

∴ CS193P: It Will Kick Your Ass

I finally got around to investigating Apple’s iTunes U service, an aggregator that offers free online courses from colleges and universities around the world. I’ve wanted to do this for what seems like years, but took the plunge only after Apple updated the service a couple of months ago.

They’ve created a universal iPhone/iPad app for lectures, notes and assignment delivery that lays out the curricula in a concise, session-by-session list. Each class session opens to video, slide and PDF content.

I’ve wanted to learn iOS programming for iPhone and iPad devices, so I clicked through to the engineering offerings. Right at the top of the list was iPad and iPhone Application Development from Stanford University, CS193P. What better source could there be?

This course is a set of recorded lectures from the Fall 2011 quarter, including approximately ten weeks of instruction as well as six programming assignments. It includes nineteen video lectures recorded during actual classroom sessions, a set of slides from each for later review, and an assignment about every two weeks.

The assignments will, after the first, melt your brain. There are a few things conspiring to make this so.

First, CS193P is a high 100-level course intended not for the casual student, but rather one matriculated into a computer science program. By the second assignment you will be expected to incorporate recursion into multiple class methods in order to create a functional RPN calculator. If any of that didn’t make sense, this isn’t the course for you.

(I hadn’t worked with recursion since I programmed Karel the Robot in Pascal to find a cookie in a maze twenty-seven years ago. It took a while for my synapses to find and replay that exercise.)

Second, and probably more to the point, this course is offered by Stanford University. It moves RIGHT ALONG. The professor, Paul Hegarty, covers the main points of each class’s topic and gives a live, hands-on code demo.

You’ll spend copious amounts of time later digging through Xcode documentation for the finer details. You’re keeping up with students who were accepted into a Stanford engineering major, so … buckle up.

(Prof. Hegarty is knowledgable and a good teacher, having been hired by Steve Jobs for NeXT right out of Stanford years ago. You could say he was present at the birth of the modern Mac architecture.)

Third, Objective-C, the native high-level language for programming iOS devices, isn’t exactly the easiest to learn. I’ve had some experience with OO languages, taking a command line-oriented C++ programming course in the early nineties and, a half-dozen years later, self-learning Java. I have a stock tracking application that I wrote in Java and used to watch my accounts rise and fall through the Internet bubble of 1999-2000 floating around somewhere.

Objective-C, however, possesses a significantly different syntax for accessing class and instance methods and properties, which takes a little getting used to.

This is the first time I’ve been exposed to both this, umm, different OO language and the model-view-controller paradigm. MVC is an approach to programming for point-and-click, graphic UI devices that separates the business parts of the code from the viewing parts by mediating between them with a controller. Complex applications use multiple MVC classes to interact with the user. Tying them together adds to the difficulty of learning the language.

The first assignment from this course was fairly easy, walking through a code example and adding functionality to a basic RPN calculator.

The second assignment quickly ramped up the difficulty, requiring the addition of programmability, test variables and conversion of RPN-format formulae for infix-notation display. That took me about a week to accomplish.

The third assignment, just finished, extended the previous assignment’s requirements to include graphing the results of a user-entered formula over a visible range of values, as well as turning what had been an iPhone app into a universal iPhone/iPad version. Working through the differences between those two displays took another week.

(iPhone possesses a small display, so you just segue from the calculator to the graph view. iPad is larger, so you have both the calculator and graph visible in a split view until the user rotates the display. Then you have just the graph, and a button to display the calculator in a popover. Both device’s graph displays must handle zooming, panning and triple-clicking to move the graph origin around the screen. All of this is accomplished in custom code.)

Keep in mind that Stanford students are taking this course along with at least another CS course, plus another science and perhaps a distribution course.

The upside to taking this iTunes U course is that I have all the time I need. I’m not a member of a class, I'm just auditing. The class only meets as often as I play another lecture. Having completed the third assignment I’m halfway through the programming part, though there are about a dozen more lectures to be viewed.

If this all sounds like a chore, well, it is. But if you want to learn iOS programming this is the course you want. The advanced topics start around lecture three or four, and by the time you’re done you’ll have a rich understanding of how to create iOS apps. You’ll be miles ahead of anyone working through a basic, self-taught course. But you’ll work for it.

No comments:

Post a Comment

Above all, follow Wheaton's Law: don't be a dick.