Welcome!

Turning Annoyances into Wonders Since Tuesday

Ken Fogel

Subscribe to Ken Fogel: eMailAlertsEmail Alerts
Get Ken Fogel via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: iPhone Developer, SEO Journal, Macintosh Magazine, Software Configuration Management, Google

Blog Feed Post

My First Day at Stanford Learning to Program the iPhone

I have downloaded the 17 lectures and 3 supplemental sessions of the CS193P course entitled iPhone Application Development

Before the registrar at Stanford writes me a cease and desist letter, let me state that I am not a student at Stanford. Rather I have downloaded the 17 lectures and 3 supplemental sessions of the CS193P course entitled iPhone Application Development from Open Stanford. According to an article published on the Stanford web site (http://news.stanford.edu/news/2009/may20/million-052009.html) there have been more than a million downloads of the videos and course material. This course ran from April 1, 2009 till June 8, 2009.

You can get the course material in a number of ways. At the ITunes Store just search for ‘Stanford iPhone’ and it should be the first course shown in the iTunes U box. You can also download the material from the course web site at http://www.stanford.edu/class/cs193p/cgi-bin/index.php. While iTunes has all the lectures and slides, the Stanford site also includes the class notes and the assignments.

With everything in place I sat down in my home office to watch lecture 1. I played the lectures on my Windows desktop and had Xcode and the iPhone SDK fired up on my MacBook. The course does not have any information on how you get the Xcode and iPhone tools or how they are configured. These tools are free from Apple and only require that you register as a developer. The Apple tools include an iPhone simulator and that is all you need for the course, owning an iPhone or iTouch is not required. If you do have one of these devices then there is another program at Apple called the iPhone Developer Program that for $99 provides you with the software to test your apps on your iPhone or iTouch and also gives you the ability to submit apps to the App Store.

With everything in place and the lights dimmed (and some snacks nearby) I began the lecture. The video was very well done. A cameraperson was used so that the lecturer, Evan Doll, was always centered in the frame. He remained in the same place adjacent to the screen in the lecture hall and the lighting on him was ideal. When he was speaking the video showed only him. When he spoke of what was on the slides then only the slides were shown. This tells me that the output from his Mac was mixed with the feed of the camera. The sound quality was excellent as he wore a wireless microphone. Although you could not hear students who asked questions, Evan did repeat the question in most instances. I would definitely give the video production four stars.

The lecturers for this course, Evan Doll and Alan Cannistraro, are all Apple employees as Stanford is just down the road from Apple. This means that they bring to the course the insight only an Apple software engineer could have. A senior Apple engineer, Paul Marcos, is also part of the team.

The first 20 minutes of the 1 hour lecture was taken up with the usual information given to students in the first class of any course. As a college teacher I was interested in how the course was to be managed, you probably won’t be. You can skip to the 23:22 mark where the actual course content begins. From this point Evan gave an overview of the devices, the software stack on the devices, and the frameworks used in developing the software. The presentation ended with a demonstration of a simple app that placed a slider on the iPhone and a label that displayed the value of the slider.

It was very handy to be able to watch and pause the demonstration while I did the same steps on my Mac. I felt for Evan when he made some minor slips, which he did notice and correct, only to have the app crash the iPhone simulator. My first attempt also failed to work. Being unfamiliar with the Xcode environment I could not see what I did wrong so I just started over again and the second time it worked perfectly.

The code from the class is also available on the Stanford site but there is minor problem with it. The project expects a pre-release beta 3.0 SDK and I was working with a 2.2 SDK. A little Googling led me to the instructions to how to change the SDK in a project in Xcode. Evan’s code worked perfectly then. This did tell me that the course material was not dependent on a specific version of the SDK and so I will switch to the 3.0 SDK for the rest of my assignments especially as I just updated my phone to 3.0.

The part of the course that I spent the most time on was the assignments. The first assignment (1a) was quite simple and produced an iPhone display with text and the image of your choice. The second assignment was a bit more challenging. The course assumes that you know C programming primarily and that you have some object oriented experience likely with C++ or even C#. The language of the iPhone and the Mac is Objective-C. Like C++ it allows for the writing of standard C code. And like C++ it has been extended to support objects. The first difference I encountered is in the syntax of the object oriented coding. I have worked with C++ and taught courses in it for many years. C++ uses dot notation to access members of an object. Objective-C uses bracket notation. For example:

C++        obj.doSometing(x);

Objective-C:       [obj doSomething:x]

The second assignment (1b) requires you to write a console application for the Mac that uses collections, enumerations, and introspection. If you have never coded in C/C++ before then this is not a course for you. As it was it took me almost three hours to complete the second assignment. I used Google frequently to fill in my gaps in Objective-C knowledge. In the last part of the assignment I spent a half hour trying to find the syntax for casting an object to a string (specifically an NSString) only to discover that I only had to use C syntax as in (NSString *)obj .

There are seven assignments in the course though they may consist of more than one part as in assignment 1. I know that one of the Assignment 2 parts requires assignment 1b. Although there is no one to grade your work you should work on them to get the most from the course. After the seven assignments there is a project of the student’s choosing. This is what I hope will be my first app for the App Store.

When I got my first Mac two years ago and my iPhone last year I always planned to learn to program these machines in their native language. Now is my opportunity. The Stanford lectures are definitely the way to go for me. I’ll write about the course again when I finish it.

UPDATE: Just watched the second lecture and had I done so before starting assignment 1b i would have been finished in much less than three hours. So before I do assignment 2 I will watch lecture 3.

Read the original blog entry...

More Stories By Ken Fogel

In 1980 I bought for myself the most wonderful toy of the day, the Apple ][+. Obsession followed quickly and by 1983 I was writing software for small and medium sized businesses in Montreal for both the Apple and the IBM PC under the company name Omnibus Systems. In the evenings I taught continuing education courses that demystified the computer to the first generation of workers who found themselves with their typewriter on the scrap heap and a PC with WordStar taking its place.

In 1990 I was invited to join the faculty at Dawson College in the Computer Science Technology program. When I joined the program the primary language was COBOL and my responsibility was to teach small systems languages such as BASIC and C/C++.

Today I am now the chairperson and program coordinator of the Computer Science Technology program at Dawson. The program's primary language is Java and the focus is on enterprise programming.

I like to write about the every day problems my students and I face in using various languages and platforms to get the job done. And from time to time I stray from the path and write about what I plan to do, what I actually get around to doing, and what I imagine I am doing.

@omniprof