Tuesday, 10 November 2009

iPhone Obj-C books for MonoTouch devs (first look)

UPDATE 6-JUN-10:This book Professional iPhone Programming with MonoTouch and .NET/C# is available for pre-order on Amazon... one of the authors might be familiar :-)

UPDATE 2-DEC-09: the first MonoTouch-specific book (that I know of) is now available to purchase/download - Building iPhone and iPod touch Applications for the .NET/C# Developer with MonoTouch (Wrox Blox). I haven't had a chance to read closely yet, but it's good value at USD6.99 so definitely worth a look.

iPhone BooksI recently received yet another addition to my 'Objective-C books for iPhone Development' collection - initially started to learn Obj-C (never happened) they are now more of a reference while learning MonoTouch.

Firstly, I have NOT read them cover-to-cover... I've done a bit of flicking, a bit of skimming and read a chapter or two. Secondly, I'm not really evaluating them according to their original purpose - to teach Objective-C - rather I'm making a personal judgement on their suitability as reference material for .NET developers.

I've listed them in their "order of usefulness" for MonoTouch .NET devs (according to me :)

Beginning iPhone Development: Exploring the iPhone SDK [BEGINNING IPHONE DEV]
Dave Mark; Jeff LaMarche (APress)

This was the first iPhone book I purchased, so I've read it more closely than the rest. I learned quite a bit from various examples and discussions in this book - it's probably at the top of the list for this reason. The writing style is easy to read and there isn't too much emphasis on Xcode (other books do seem to focus on Xcode, the Head First one most heavily).

The initial chapters are probably best replaced with a MonoTouch 'Hello World' screencast - you don't really need to know all the Xcode, pch files and @synthesize that the book discusses (and there are quite a few free resources around that cover "your first MonoTouch app").

• Interface Builder examples are relevant
• Friendly colloquial tone
• Widest variety of topics (includes localization, accelerometer)

• Large swaths of Objective-C in some chapters
• Still need to decode Objective-C in the examples

Overall, though, my favorite of the bunch.

The iPhone Developer's Cookbook: Building Applications with the iPhone SDK
Erica Sadun (Addison Wesley)

I'm a big fan of Erica's from her blog and applications when the iPhone and iPod Touch first appeared and were programmable. Text is easy to read. Erica often references "when the iPhone first appeared" or "during the Beta period" - often interesting insights that add some fun to the text. There are also references to many 'undocumented' APIs - they're clearly highlighted to avoid confusion, but unfortunately they're even more difficult to use from MonoTouch than Objective-C... I felt a bit "left out" on first reading, although with btouch in MonoTouch 1.2 I'm wondering whether it might be easier to access these APIs now? (even though we're not supposed to...)

Chapter 2 - Views - does a really nice job of gradually introducing various concepts, and the Objective-C is minimal. That chapter on it's own is probably worth reading for anyone coming to iPhone programming. The rest of the first half is also fairly easy to follow (View Controllers, Basic Tables) - if the examples were in C# they might be my favorite 'introduction to iphone programming' :)

Towards the end of the book the amount of Objective-C does increase to a few multi-page listings that are more difficult to read (and probably beyond beginning C#ers) but overall the book is good value.

There is a 2nd edition due in January 2010 which will probably address my other main concern with this book: that it pre-dates the latest iPhone OS releases and hardware. Not a big deal really, but it's always nice to have info on the latest and greatest.

iPhone SDK Application Development: Building Applications for the AppStore
Jonathan Zdziarski (O'Reilly)

Less "reading" in this book - rather than longer explanatory paragraphs the author uses smaller chunks of text interspersed with bullet points, callouts and small and large Objective-C listings. This actually makes it better as a reference book than a front-to-back learning tool - and that makes it more suitable for MonoTouch in my view.

As with the other titles, the initial chapters cover Objective-C concepts like messaging, implementation, protocols, categories and posing(!) which you aren't likely to need as you start out with MonoTouch (although you might return to read about them later, to get your head around more complex examples).

I've used the remainder of the book to 'look up' various things that I want to learn about or need examples of, usually as a backup/alternative to the material that I've found in other books or on the web. It doesn't have the breadth of "Beginning iPhone Dev" nor the easy readability of Erica's stuff, but I have definitely picked up some useful tidbits from this book.

Head First iPhone Development: A Learner's Guide to Creating Objective-C Applications for the iPhone
Dan Pilone; Tracey Pilone (O'Reilly)

I love the Head First series from O'Reilly, so I was determined to like this book; and it definitely lives up to it's promise as a Head First title. The writing, imagery, exercises and screenshots are all as you'd expect and it is really good at explaining Objective-C, Xcode and Interface Builder concepts... however that's partly what makes this volume less useful for C#ers: the writers go out of their way to explain/show how to do everything with Xcode and Interface Builder! As a MonoTouch developer I find myself only in MonoDevelop writing code and building my interfaces in code... so to my dismay I find myself unable to put this book at the top of my list.

It is still a fun read, and the non-techy bits (of which there are many) are extremely relevant to ALL iPhone devs. The recommendation to design your UI on paper, to follow Apple's Human Interface Guidelines, to remember to test on a Touch, and much more... if I ever decide to really learn Objective-C, I'll probably come back to this book and run through all the examples from go-to-whoa since it does try to teach the language and the SDK (and I really need help with my memory management!).

iPhone Cool Projects
Bennett et al (Apress)

The most 'attractive' of the five, due to the easy-to-read typesetting and colorful (yes COLOR) layout and imagery; this book probably doesn't really even belong in the list. It is more of a 'discussion' of iPhone application design - there is a fair amount of Objective-C throughout but it's mainly used to illustrate points of discussion, and the chunks are small enough that a C# developer can easily scan them.

Definitely fun to read - but you'll want any/all of the other books first to advance your knowledge of the iPhone SDK and Objective-C before you start trying to use the examples in this book. It probably isn't a good choice as a 'reference' or a learning tool for C#ers until you've got a few apps under your belt.

As time passes and my knowledge increases my opinion of these books might change. Perhaps others have different opinions on what makes a good "Obj-C for C#" book, or have come across other titles? I'm sure there'll be C#/MonoTouch specific titles on the market eventually - it will be interesting to see how they read too!

Monday, 9 November 2009

Another MonoTouch 'conference app' - PDC09

PDC09I'm not planning on making a habit of this, but having spent the time putting together the Monospace conference app and seeing tweets from various Mono people that they were heading to PDC09, I figured it wouldn't take too long to copy some PDC data into the existing MonoTouch C# app 'framework'.

A new view (Sessions), a new icon (Speakers) and a new location (Underground) are the main changes - the rest is just SQLite and graphic tweaks. The source is available for download - PDC09_01.zip (124Kb).

NOTE: This is for demonstration purposes only - the Speakers data is incomplete and the Schedule & Sessions are subject to change! Use at your own risk :)

UPDATE: to be clear, this app is not available on the AppStore -- it is just an example of the kind of thing you can write in C# for the iPhone using MonoTouch from Novell. If you have a MonoTouch licence then you can download the source (124Kb) and install it on your phone.

Monday, 2 November 2009

MonoTouch UINavigationController Placemat

In one of my other posts I included a 'placemat' diagram to help make sense of the code.

Someone commented that they found the presentation useful, so as a quick post today I decided to placemat the Roget's 1911 Thesaurus sample.

Rogets 1911 Placemat

Note that I'm not suggesting this is the neatest, tidiest, best-practice way to structure a MonoTouch application (I'm learning along with everyone else). This is purely to help you find your way around the example code.

For example... on thing I learned is that I didn't really need to pass an instance of the 'root' MainViewController around - each UIViewController has a NavigationController property referencing the UINavigationController that 'contains' it. Therefore any given UIViewController that has been added to a UINavigationController can call this.PushViewController (or else pass a reference to this into the UITableViewDelegate constructor to use in RowSelected.