How can a functionally illiterate developer learn to read code syntax?
November 7, 2008 10:34 AM   Subscribe

Can a functionally illiterate developer learn the basics of coding Objective C (on the iphone)?

Can a functionally illiterate developer learn the basics of coding Objective C (for the iPhone)?

I'm not a developer by trade, but I get OOP, I understand the theory, and I've done a pretty decent job of figuring out how to write programs by reverse engineering other programs, and just muddling through methods and functions until I get it right.

Here is an example of a program I've written.

In essence, I know how to develop, but I don't know how to code. Or, I can't read the code, headers, really anything. None of the books or pamphlets I've read explain the basic syntax of a language. Most materials assume you're either an experienced developer who just needs to know what's different; or they assume you're a complete moron (sorry) and need a mere cookbook.

I *get* object oriented programming. I get arrays, pointers, and I've done a good job figuring out what methods and functions I've needed so far, but learning ANY new method, function or class is painful enough for me that I've hit a wall.

Are there any materials that can help a functionally illiterate developer learn to read code? I've consumed all of Apple's online documentation, and a few forums as well. Looking for that one magic book that will teach me to read.
posted by skybolt to Computers & Internet (10 answers total) 6 users marked this as a favorite
 
You seem to be using a personal definition of "functionally illiterate," but I think I see your point. Do the tutorials on Apple's site still fall short? They seem to be attempting to address the issues you'd like to tackle.

Beyond that, learning as you get older (and more expert in other things) can indeed seem like hitting a wall. Perseverance is the key, but I'm sure you've exercised that in picking apart the code that you've used and written so far. Don't be discouraged, and be sure to reflect on what you've done so far. You may only be looking too closely, missing the forest for the trees, and not realizing that you already know a lot of syntax.
posted by rhizome at 10:42 AM on November 7, 2008


Sounds like your problem isn't really with Objective-C: it's really pretty straightforward, especially if you know C, which from understanding pointers you probably do.

If you're hitting the wall with learning new classes and methods you're probably not grokking Cocoa. So buy Cocoa Programming for Mac OS X and be enlightened.
posted by bonaldi at 10:58 AM on November 7, 2008


Get a book (C for Dummies, or something similar). Learn C, then attack Objective-C, and you'll find you know it already.

For that matter, learn Java, there's a million tutorials. Once you've learned one C-like language, translating your learning to a different language will be simple.
posted by blue_beetle at 11:38 AM on November 7, 2008


None of the books or pamphlets I've read explain the basic syntax of a language.

Do you understand the syntax of C? Quite a few Cocoa books gloss over this (mainly because it deserves a separate treatment in another book), but it's crucial to programming in Obj-C. If this is the case, I highly recommend The C Programming Language by K&R.

After that, I would second bonaldi's recommendation for Hillegass' book.
posted by shadytrees at 12:42 PM on November 7, 2008


I'd go through a classic C book like K&R and follow it up with Apple's ObjC documentation. That'll give you what you need to thoroughly understand the language; understanding any particular class or Apple toolkit is another matter.
posted by hattifattener at 12:45 PM on November 7, 2008


When you sign up for an Apple developer account, you'll get access to a lot of sample applications that demonstrate principles for different parts of the UI* kit.

Beyond that, I recommend picking up Hillegass' Cocoa Programming for Mac OS X to learn how to write a Mac OS X application. The Cocoa framework is very similar to the Cocoa Touch (iPhone) framework, and the Objective C syntax is identical.
posted by Blazecock Pileon at 1:25 PM on November 7, 2008


[throat makeNoise:@"Ahem" withMeaning:@"Read thread :)"];
posted by bonaldi at 1:35 PM on November 7, 2008


Sorry, I second bonaldi's recommendation. It's a good way to get started with the thought process of how Apple's engineers want you to write their applications. My advice is to go through the book and not think too much about the why's — as you keep going and writing more Objective C, the language and the frameworks get much clearer.
posted by Blazecock Pileon at 1:43 PM on November 7, 2008


You've received some good recommendations for learning C and Objective-C. I would add that, if iPhone development is your goal, you'll be using Objective-C 2.0, and you should try to choose a book that focuses on the 2.0 version of the language. (If I understand correctly, this also means you'll need Leopard rather than an earlier version of OS X.) For what you're asking, the focus should be on the language, not on Cocoa or Xcode. Unfortunately, I don't have any specific book recommendations; I've only played with Obj-C very briefly thus far.

I agree with the suggestion to learn C, and I recommend this book. Yes, it's huge, but that's partly because it has a lot of good review questions and programming exercises (which you should do). K&R is the authoritative book on C, but it's incredibly terse and assumes the reader is able and willing to lock onto every piece of information that's presented with laser-like precision. Some of us learn better with a little more hand-holding.

What I really came into the thread to say is more general. I think you should try to unpack your question into two separate problems: reading code and learning syntax. These seem so intertwined as to be inseparable, but they're really two different skills.

While it's probably possible with enough effort, people don't really learn language syntax by reading. You learn by doing. Try to write a 'hello world' program and compile/run it. Oops, the compiler gave an indecipherable error message. Google it and figure out what's wrong with your syntax. Once you have it working, expand it to ask the user for their name and then say 'hello [name]'. Google your errors, then add something else. Rinse and repeat.

Don't be put off by the simplicity of this. A program that demonstrates every distinct element of a language's syntax can be surprisingly small; there aren't really as many syntax rules as it seems there must be, at first. The best way to remember any particular element of syntax is to do it wrong, find your mistake, fix it, and observe the results.

Reading code is a separate skill. Let me emphasize: Reading code is a skill. It's not something most of us can just pick up. It must be practiced, just like learning to read Kanji or sightread music. A few fortunate people seem to have the ability to instantly read code in a language they've never encountered before, but this is nearly always an illusion--those people, through much practice, have learned the skill of reading code so thoroughly that they can apply that skill to any language (partly by making some educated assumptions about what the unfamiliar syntax is doing).

So don't feel bad because you have trouble reading. You just need more practice. You will develop the skills to read each line of a method and understand what it does, and then to read an entire class file and understand how its members coordinate to create a distinct object, and then to perceive how all those objects work together to form a complete program. You will struggle at certain points of this process, but the 'magic' is that the more practice you get, the less you'll struggle.

About learning new methods: You need a reference to the language's standard library. I don't know where to find one for Objective-C, but this (for Java) is an example of what I mean. I spend zero time trying to memorize declarations for specific methods; that's what the API reference is for. If you need a method frequently, you'll remember it automatically after the third or fourth time looking it up and using it. If you need it infrequently, why try to memorize it at all when you can just look it up?

Hopefully someone here can tell you where to find the API reference for Obj-C online. If not, join the Apple Developer Connection (you can get a free account) and, if you're not able to find it in their documentation, ask in their forums.
posted by [user was fined for this post] at 9:23 AM on November 8, 2008


Wow, I just realized how long that got. Sorry about that.
posted by [user was fined for this post] at 9:24 AM on November 8, 2008


« Older I bet you think this song is about you.   |   Portable Comic Readers Newer »
This thread is closed to new comments.