I’ve been learning iPhone development for the past week or two. I started off on a lynda.com video series but then moved to this extremely helpful Stanford course.
I do not have a background in programming. I am highly proficient in HTML and CSS with about two years of intensive usage, I have working knowledge of PHP, and I have a very basic knowledge of javascript and jquery (read: I can take other people’s code snippets and adapt it for my purposes). That’s it – just easy web stuff. No real object-oriented programming experience except for what I have picked up here and there from customizing a php shopping cart and listening to my father, who is apparently an excellent programmer.
It’s been a little over a week since I started, and I just finished lecture 4 of the Stanford series. I’ve finished all the assignments up to date with no major issues. One of the most at once infuriating and rewarding things about learning a new skill is working through the niglets and sticking points that inevitably arise from lack of experience. In programming this manifests as seemingly insurmountable frustrations that really get under your skin – everything looks completely right, but the damn program still throws some sort of cryptic error! Or even worse, it doesn’t throw any error and your program just doesn’t work correctly.
For example, this single problem got me for about two hours. In Objective C, you can access setters and getters in two ways. First, you can actually invoke the functions conventionally:
myName = [myObject name]; //getter
[myObject setName:@"Fred"]; //setter
OR you can use dot notation as shorthand, which looks much prettier.
myName = myObject.name; //getter
myObject.name = @"Fred"; //setter
So what Objective C apparently does, is take your setter and getter definitions and translate them into a dot notation format that you can use if you wish. The problem arises, though, when I didn’t realize that the setter definition had to start with “set” and then a capital letter – I had been defining them as just “name” instead of “setName”! Because I had used @synthesize and I was trying to override the default setter rather than create it, the damn thing didn’t throw an error but instead completely fucked my code up. Pretty crazy – and I haven’t even gotten into memory management issues yet.
Anyways, what I’ve learned so far is the basics of Objective C, working with Xcode and Interface Builder, and the basics of MVC. I also grasp object oriented programming concepts, and some other stuff used a lot in Objective C like delegation. It’s relatively simple stuff so far – I haven’t really had any major trouble with grasping any of the material.
I finished doing part of an iPhone app that manipulates polygons. For example, I set a minimum and maximum number of sides, and have two buttons that increase and decrease the number of polygon sides whenever I touch them. It works exactly as it should so far and I’m extremely pleased with myself.
The next Stanford lecture is Lecture 5, which has to do with custom views and drawing – should be very interesting! I’m about to watch it. This is pretty awesome – I’m actually looking forward to watching new lectures and doing new assignments. We’ll see how it goes!
Hell, if a 9-year-old can do it, there’s no reason why I can’t.