Thursday, January 8, 2009

IPhone Programming, where to start?

During my Christmas vacation, I decided that I will learn Iphone programming.  As soon as I finished ordering my Mac, I was on the Internet to try and find literature about this new development platform.  Sometime it's good when there aren't that many choices of books on a subject, and in the case of Iphone programming, there really isn't that many books available. As long as their some good choices (anyone ever seen a good Direct X book?  I haven't) then having little choices makes shopping much easier and faster.    It really doesn't take me long to see if I'm going to like a book, you can learn a lot from the content pages, the intro and the index, readily available on Amazon.  Most people agreed, "Beginning IPhone Development" was one of the better books to start learning IPhone programming.  

But wait a minute, I need to learn Objective-C also? And Cocoa?  This is slightly more complicate than I first thought.  I certainly don't back down from a challenge so I ordered another book for Cocoa, "Cocoa programming for Mac OS X".  It was rather well reviewed and seems like the goto book for this framework.  Objective-C was a bit more complicated because the book of choice "Programing in Objective-C" by Stephen Kochan is between edition right now.  I would love to get the book as fast as possible, but there was going to be a new release in only 2 weeks!  Surely I could do without having a book on the subject till then.  So I decided to pre-order the "version 2.0" and wait on this book a little while longer.  I received an email today that I should be expecting it by mid to end of February. 

So far, I've read through the Beginning IPhone Development and I've really enjoyed it.  The syntax (Objective-C) is really really getting on my nerve, but more on that later.  I haven't had the need to read the Cocoa book, and I quickly noticed that the IPhone framework although similar is not the same as the Mac OS X programming.  By browsing quickly, I can see that there are things that would be useful for me, but these are normally already well covered by the Beginning IPhone Development book.  If your interest is with IPhone programming, I probably wouldn't get the Cocoa book if you are on a budget.

Objective-C
The IPhone programming book does NOT teach you anything about Objective-C, but it's a good thing.  I hate swiss army knife type books.  If I knew Objective-C well, having a book on IPhone development explain it to me would slow me down with learning what I actually want to learn: IPhone programming.  It would also just do a mediocre job at covering Objective-C compared to a purely Objective-C book.  So many books go down this road and it always annoys me (Appendix are alright).  Kudos on not making this mistake.  Unfortunately I do not know Objective-C, but thankfully the book points you to an online resource that does a great job at covering the basic of the language.  You'll need to register with the IPhone Dev Center, there you will find many resources here that will be absolutely necessary for learning IPhone development quickly. 

I'm normally really quick at picking up new language, the last language I had to learn was C#.  I started and finished "Programming in C#" by Jesse Liberty  on a transatlantic flight over to Europe.  Alright, so it was the first edition and it was slimmer than the current version but nonetheless I was very impressed at how intuitive the language and the environment was.  C# is now the first language I turn to as soon as I have to do any tools.  I also looked at using it for games, unfortunately the support for XNA isn't great for the casual market.  The Visual Studio IDE with C# is top notch when developing user interface, I've never seen a better application for doing GUI development.

Objective-C is no C#!!!  The language feels quite archaic and the Cocoa framework is nowhere as clear as .Net when it comes to naming convention.   I was very surprised by XCode though, I actually find it very good for the most part.  Code Sense is a bit inferior to Intellisense but I was just happy to have something that works!  As I previously mentioned in an earlier post, I love to be able to switch between header and cpp file with a hotkey.  Maybe this is now available in 2008, which I haven't switch to yet, but 2005 only allows the Go to header and in 2003 you don't even have that luxury.  Instead I believe I use King Tools to be able to have this functionality. 

As much as I really like XCode, Interface Builder is a major FAIL in my book.  It reminds me of the old MFC, if I can ding Beginning IPhone programming in only one way is that the authors alludes that this approach is better than generated code. My first annoyance with it is that it's not really integrated in XCode, which makes my environment a mess.  After clicking on a few nib files, I'm forever trying to find the interface that I need to work with.  Thank god for Expose!!  If I could change one thing, this would be it.  Find a way to integrate it into XCode, I want it to go away when I close my project and open another project.  In one instance I had made a copy of a project that I had so I could make some non-destructive changes.  To make sure I didn't mistake one project for another, I closed down XCode but forgot to closed down Interface Builder because it was residing in another space.  Next thing I know I'm modifying the right project, but the wrong interface....grrr.  I'm not sure how often someone would need the Interface Builder up without having the XCode running.  Maybe this is useful for some people and that they now have it part of their workflow.  I just don't see it working for me right now.  Another thing that really annoys me with Interface Builder is that when it comes to programming, I hate magic.  I want to understand how things happen and in C# I know exactly what is happening because I see the code.  I know that I can enter the same code manually and get the same result.  In Interface Builder, I believe the nib is serialized data that does these connections for you.  Because of this, my learning is much slower.  How I register callback functions for my actions?  How do I create a new GUI element programatically.  I can do a bit of digging and figure these out, but because it's not in my face all the time it takes much longer. I'm also always more comfortable looking at code to see if everything is setup right.  Now I have to check my code, then change application and check if everything in Interface Builder also is correct.  I'll get use to it, but I'll never like it like I like C#.  Maybe the comparison to MFC is a bit harsh though :)

As you might have realized from my previous paragraph, I do not currently have any version control system.  I have perforce on my windows machine and I really like it.  I might have to check to see if I can't setup some kind of CVS system on my Synology backup system.  This would be the best approach for me since I could share code base easily between all my OS.  I installed GIT quickly but really haven't played with it.  If anyone has suggestion please fire away.  I need to set something up sooner rather than later.  Time Machine is alright, but it won't replace a good configuration management system. 

Well, back to the grind...

No comments:

Post a Comment