Filed under: Books, Developer, iPhone
Starting out with Objective-C
I recently decided to embark on a personal challenge to learn Objective-C (the programming language behind Mac and iPhone applications) so that I could one day get applications into the App Store. I'm not looking to make millions with a fart machine app, but I do want to see some of my ideas come to fruition and end up on some iPhones. While we've previously mentioned how to delve into programming in Objective-C, there have been some recent releases of educational materials that can help those who want to learn the language:Programming in Objective-C 2.0 (book, $44.99)
This is the latest release of Stephen Kochan's series which some consider to be the Objective-C bible. It has a wealth of information jammed into almost 600 pages, and it will take you from simple variable assignments to advanced class implementation. I'm over halfway through this book, and the text is easy to read (not too high level), and is broken up in a visually appealing style with sufficient whitespace to be gentle on your eyes. If you're only interested in programming for the iPhone, you may only want to rely on this book for its wealth of foundational Objective-C material as it only has one chapter devoted to the iPhone.
Learning Objective-C on the Mac/Beginning iPhone Development (books, $39.99 each)
This new series from Apress offers two options to would-be developers. If you're comfortable with Objective-C, grab their iPhone book and begin learning about the SDK and how to implement the iPhone features. If you're new to the language, pick up the first book to build a foundation so that if you decide to program for the iPhone, you'll be prepared.
Coding in Objective-C (screencasts, $5 per episode)
This is currently my favorite way to learn the language. While the company behind these high-quality screencasts, Pragmatic Programmers, has only released 2 episodes for Objective-C so far, they are a great way to learn thanks to the usage of audio and video. Being able to see the code change and grow and hearing the host's voice explain exactly what is going on is much more engaging than reading a book. The screencasts last about 45 minutes per episode.
These are only a few ways to learn Objective-C. Apple makes plenty of sample code available, and with the removal of the iPhone development NDA more and more blogs and books are coming available making it easier to learn and reducing the time to get creations finished. If you are already familiar with Object Oriented Programming (languages like Java and C++), learning Objective-C should be a snap.


![TUAW [Cafepress]](http://www.blogsmithmedia.com/www.tuaw.com/media/tuaw-cafepress-promo.png)


Reader Comments (Page 1 of 3)
a ham sandwich said 7:49PM on 1-15-2009
i made a goal to learn objective-c too, and found the syntax to be totally palatable coming from a java and c++ backround, but what blew my mind was the GUI "linking". using interface builder, then switching to back to xcode and back and drawing the lines between them really didnt sit too well with me. habout you guys? any tips?
Reply
Erik said 8:46PM on 1-15-2009
I'm coming from Actionscript 3/Flex and the GUI tools concept is definitely hard to grasp given the fact they are not integrated. It's going to be a while before I am comfortable.
Todd Ritter said 8:00PM on 1-15-2009
My biggest struggle right now is memory allocation...having to define and release variables unlike other languages like PHP. I am trying to figure out when I have to explicitly release things. That is the topic of the second episode of the screencasts I mentioned though.
Darren said 8:37PM on 1-15-2009
Coming from the Delphi/.NET/NetBeans model of GUI development, I can relate. One of the big hurdles is understanding how to use Interface Builder effectively, and how to structure your classes and NIBs. IB is far more powerful and flexible that what you get with .NET and NetBeans, but that flexibility means you must have your model-view-controller design in place before you go about building the "views" in IB. It took a little while, but I'm a total Interface Builder convert.
IB is less relevant on the iPhone where most interfaces are constructed inside a table view, but it's still useful in some situations.
Patrick said 9:53PM on 1-15-2009
Regarding the difficulty of moving to the Xcode/Interface Builder method of writing programs from the old "all the information is in the code" method, I feel your pain. Know that the pain will go away, and at some point you will replace frustration with elation.
In the meantime, take a deep breath, and realize that others have been down this path and you can, too. Apple didn't change the paradigm just to annoy us, they did it because they think this new way is better. Is it better? I don't know, but I do know that the old way is not necessarily better, it's just the way I first learned it. Now I need to learn the new way.
I used to scream at IB and the jumping from Xcode to IB to Xcode to IB and finally back to IB. I couldn't figure out what part to do in which tool and when. For example, in the old non-Cocoa non-Apple days if I wanted a 200 x 400 window, I'd just write in the code CreateWindow(200, 400, blah, blah). Now I go to IB and create a 200 x 400 window, then link it to an object, and it's magically created when I need it.
SSteve said 2:31AM on 1-16-2009
In an interview at http://www.informit.com/articles/article.aspx?p=1220319, Aaron Hillegass gave what I think is the most important advice to new Cocoa programmers. He said "Programmers who have spent a few years working in Visual Studio get freaked out. They ask me stuff like, "Can I write Cocoa apps without using Interface Builder? I like to see the code. Maybe I can just explicitly create my windows and the views that go on it?"
It is difficult to explain how the NIB file (and a few other scary ideas) create leverage. It is that leverage that enables one guy in his basement to compete with a team of engineers at Microsoft or Adobe. It is like I showed a chain saw to a early American colonist, and he said, "Can I cut down the tree without starting the engine? I don't like the noise. Maybe I can just bang it against the tree?"
Just keep working on it and reading everything you can. I promise it will make sense. Then you'll be amazed at what you can do with minimal coding.
Jonathan Wise said 7:52AM on 1-16-2009
Coming from C# and Visual Studio, and also Javascript/DHTML, I've got to say I agree with you. I appreciate the MVC approach, and how its enforced by the development environment, but it does seem more complicated than necessary. And XCode has some cool features, but it seems about 10 years behind VisualStudio...
antiorario said 7:53PM on 1-15-2009
The company *has* released, not "have". C'mon.
Reply
Todd Ritter said 8:04PM on 1-15-2009
Good catch..fixed. Thanks.
Jonathan Sterling said 10:41PM on 1-15-2009
In fact, it is completely correct to refer to a collective entity in the plural. Please.
antiorario said 2:01AM on 1-16-2009
Actually, it's correct only "when it refers to the members of the group as individuals, as in My family are always fighting among themselves." (American Heritage Dictionary, 'collective noun'.)
This is no such case, since it's the company as a whole that releases software.
johnson 412 said 2:10AM on 1-16-2009
Either scenario is correct. In the case that the author was referring to the company as a singular entity, the correct usage would be "has." However, if the author was referring to the company as a group of its employees, then "have" is the correct conjugation.
This rule is made even more ambiguous in this case due to the fact that "company" is often used to refer to both singular and plural entities. For instance, company may mean a corporation or business, but it may also be used to refer to a group of visitors ("I had company over for dinner."). To avoid confusion in this case, a more common plural arrangement could be used, such as "...the folks at X company have released..." This would eliminate any ambiguity, as only the plural conjugation would be correct.
Either way, back to the main point of the article. I may look into programming in Objective-C, but as I am a Mechanical Engineer, my only current programming experience is in MATLAB. I'm not sure how well the translation would carry over seeing as, if I'm not mistaken, MATLAB is based on C and FORTRAN. I've also considered looking into Python for simple Linux scripts. Anybody have any suggestions as to what would be the easier route? I don't have an iPhone, but do have a Mac, so Objective-C is not as big a deal for me as it may be for others.
Bart said 4:24AM on 1-16-2009
"When someone point at the moon, don't stare at his finger or you miss all the heavenly glory" - Bruce Lee ;-)
JR said 8:14PM on 1-15-2009
It would be really nice if you could mention what type of programming background you currently have. Otherwise, it may be difficult for people to get a gist of how easily you're able to pick it up depending on your previous experiences.
I'm curious to learn Objective-C as well, but I'm really only a PHP developer. I've done some Basic and a little bit of VB in the past, as well as some AppleScript, but nothing touching C or C++.
Reply
Todd Ritter said 8:19PM on 1-15-2009
I did some basic C++ programming in college (a few years ago) and never grasped classes/objects at the time which are obviously the keystone of object-oriented programming. Kochan's book seemed to make learning classes really easy for me.
If you are comfortable developing software in general, I think Kochan's book will be fine for you. If you have never made a function or defined a variable, you may be lost.
JR said 8:23PM on 1-15-2009
I've programmed PHP classes and other various PHP applications for internal use at our company. But by no means is it how I make my living - I do it more as a hobby or use PHP to fill the gaps in certain areas.
Aaron Vegh said 8:16PM on 1-15-2009
Not sure how you could miss Aaron Hillegass's Cocoa Programming for Mac OS X. That's considered "The Bible" by the programming community.
Reply
Todd Ritter said 8:17PM on 1-15-2009
That was already mentioned in Erica's article that I linked to.
Keli Fancher said 8:28PM on 1-15-2009
I have decent experience with oop, mainly java, and have been meaning to pick up Objective-C. Several months ago I bought the first version of Kochan's book, I haven't had the time to delve into it deeply-does anyone out there think I should pick up his new version is there that much different between the two?
Reply
zebrum said 8:41PM on 1-15-2009
I wouldn't bother with that programming reference book. You will achieve more starting with Hillegass book that gets you building OS X apps from the outset.
Reply