Search
Follow
Recent Comments

Entries in review (8)

Thursday
May102012

Programming iOS 5 by Matt Neuburg

My list of book resources has lacked a strong recommendation for iOS for some time. There are a lot of good introduction to iOS programming books available but I struggle to recommend just one as the definitive guide. Programming iOS 5, 2nd Edition by Matt Neuburg (O’ Reilly Media, March 2012) is a major update to the author’s earlier Programming iOS 4 book which may just fill the gap.

First Impressions

The first thing I have to say is that this is a massive book with the dead-tree version weighing in at 1016 pages. Luckily I read the ePub version using iBooks which I prefer for technical books. You are going to want to annotate, highlight and bookmark for future reference with this book. You can read it from cover-to-cover but it will also serve you well as a reference book when you need to review topics. Note though that if you are looking for a tutorial or cookbook style approach this is probably not the book for you. I guess Matt may have received some criticism for the iOS 4 version of the book as he makes the purpose of this edition very clear up front:

The purpose of this book is to proceed by focusing on the underlying knowledge needed for an actual understanding of iOS programming. That is precisely the opposite of a cookbook. This book has no simple recipes ready for you to drop into your own code and come up with an app. I don’t give you some fish; I teach you what a fish is and what you need to know to obtain one.

Even though it is not a cookbook all of the code examples are available on GitHub which is an approach I wish all authors would adopt. It makes it so much easier to browse code and also ensures that any minor typos get fixed quickly. Emphasis is given to features new to iOS 5 such as ARC and storyboarding which helps if you are transitioning from iOS 4 but no prior iOS knowledge is assumed.

In Depth

The book is divided into seven major sections as follows:

  • Section I. Language
  • Section II. IDE
  • Section III. Cocoa
  • Section IV. Views
  • Section V. Interface
  • Section VI. Some Frameworks
  • Section VII. Final Topics

The first five sections represent maybe two thirds of the book and step by step provide a thorough coverage of the fundamentals of iOS 5 development. A lot of iOS programming books either assume prior knowledge of C or include a quick summary in an Appendix. This books kicks off with coverage of both the C and Objective-C languages and then introduces Xcode and Nibs.

With the basics out of the way Cocoa is introduced by way of the foundation framework, categories and protocols, notifications, the delegation pattern, actions and the responder chain. It is also at this point that the detailed discussion of memory management is introduced which is a mandatory and key topic for any Cocoa book. The book is written with the assumption that you will be using ARC but also stresses that you still need to understand the Cocoa memory management model behind ARC.

The Views section provides good explanations on the view hierarchy, frames and coordinate systems, drawing, layers, animation, handling touches and gestures. The Interface section completes the fundamentals with coverage of view controllers, table views, popovers and split views and an exhaustive look at the numerous other views and controls.

The last two sections of the book tie up some loose ends with coverage of additional frameworks and topics that don’t fit elsewhere. This includes coverage of many of the more common frameworks including audio, video, music library, photo library, address book, calendar, mail, maps and sensors (e.g. location and acceleration). The final section finishes up with some quick coverage of file management, networking and threads (including both NSOperation and Grand Central Dispatch). The use of iCloud is also covered briefly in the discussion on the UIDocument model.

Likes and Dislikes 

What I like about this book are the numerous hints, tips and opinions from Matt as he covers each topic. I don’t want to see a reproduction of reference material that I can just as easily get from Apple. What I want is insight into what an experienced developer thinks about the topic at hand. For example, there is a very good explanation of storyboards but what I found interesting about that section was Matt’s strong opinion on storyboards and why you might not want to use them. The explanation on popovers gets a similar treatment and in both cases I have to agree with the conclusions that Matt reaches.

There were so many new features introduced with iOS 5 that I think even somebody with iOS 4 experience will find this book useful. Changes from iOS 4 are highlighted throughout the book which should help when making the transition.

Even though this is a huge book there are still some topics that are not covered. It is easy to forget how big the iOS SDK has become so I think it is fine to skip topics like Game Kit, iAD integration, Printing, In App Purchase and the long list of other iOS Frameworks and topics. If you have a good understanding of the basics you should have no problem figuring out the less common frameworks on your own.

Personally I would have liked to see Core Data and maybe also Accessibility covered. I consider Core Data to be a fundamental Cocoa technology and as I posted recently I would like to see Accessibility get some more attention in general from developers and book authors. Section VI of the book covers a number of interesting but not vital frameworks such as accessing the music and photo libraries, the address book and calendar which I would exchange for some coverage of Core Data. That is a very minor criticism though for what is otherwise a comprehensive coverage of the iOS universe. 

Final Comments

There is a lot to recommend about this book and I don’t just mean because of the size. The primary purpose of the book is to provide you with a deep understanding of the language and iOS frameworks and I think it succeeds in that task. Of course that takes some effort on the part of the reader and I can imagine that this book will not suit everybody. Clearly if you are looking for quick high level survey of iOS 5 with some sample code to get you started this is not the book for you. On the other hand if you are prepared to invest the time I would be surprised if even experienced iOS developers can read this book without learning something.

Tuesday
Aug302011

Book Recommendations

I have posted the odd book review on this site but I have for some time been meaning to collect my book recommendations into a single page that I can more easily keep updated. Well today I finally got around to adding a resources page to the site and made an initial pass of my bookshelf to see what I could recommend.

My intention is to only recommend books that I have actually used or continue to use. A big problem with technical books is that they can very quickly become outdated. That is especially true right now with books on iOS development which is a topic undergoing almost continual change. As a result of this I actually have only one book covering Cocoa and iOS development currently on my recommended list. Something that I hope will change over the coming months.

One introductory book that is often recommended is “Programming in Objective-C” by Stephen G. Kochan. It has recently been updated to include Xcode 4 but it looks like it will be updated again before the end of the year to cover iOS 5 and Automated Reference Counting (ARC). The Big Nerd Ranch also have some interesting introductory titles including the recently released iOS Programming book and an upcoming Objective-C Programming book. If I find the time to check them out I will of course post my reviews here.

Saturday
Apr092011

Objective-C Fundamentals

There seems to be a never ending number of books which provide an introduction to iPhone and iOS programming. Both the introductory books that I used when starting out with the iPhone are now long overdue an update so I have been on the lookup for something to recommend to new iOS programmers for a while.

Objective-C Fundamentals by Fairbairn, Fahrenkrug and Ruffenach (Manning Publications) takes a slightly different approach to most such books by focussing on the Objective-C language rather than Cocoa Touch. The Cocoa Touch framework is mentioned but more as a way to illustrate aspects of the language. The book is subtitled “For iOS 4 and the iPad” so the example code and framework discussions are targeted at iOS rather than Mac OS X. Having said that most of the language concepts (with the possible exception of memory management) apply equally to OS X programming.

This review is based on an early access edition so there could be some minor changes in the final released version.

Part 1 Introduction to Objective-C

The book starts with the creation of a simple app to introduce Xcode and related tools (examples use Xcode 3). Once that is out of the way it introduces the basic data types. A lot of this discussion is not really Objective-C specific since the data types discussed are really C data types. So C structures and arrays are covered for example. If you are coming to iOS programming with prior knowledge of C this will not be anything new and you can probably skim through the early chapters. However for somebody without much experience of C these earlier chapters are well done. There is a fuller discussion of C basics in the appendix for those that need it.

Things get more interesting when the concept of objects are introduced and I think the authors do a good job of covering the Objective-C way of doing things. The NSString class gets good coverage as do the NSArray and NSDictionary classes. All of which need to be well understood by an iOS programmer. Enumeration and the boxing of basic data types so that they can be stored as objects are also covered. There is some good attention to detail here as some of the more obscure parts of the language that are often overlooked get explained (for example the difference between nil, NULL and NSNull).

Part 2 Creating and Extending Classes

With the basics out of the way the book starts to dig into the core of the Objective-C language. The sections on creating classes cover declaring instance variables and methods. The key concept of getter and setter methods is introduced first before covering the use of property and synthesize declarations and the dot syntax. Subclassing is covered but so are Categories as an alternative to subclassing which is useful. Interestingly there is also a discussion of Class Clusters. I should say that advanced topics such as Class Clusters are not covered to the detail you would find in a book such as Cocoa Design Patterns but it is good to see that they at least get a mention and brief explanation.

The chapter on protocols uses the UITableView as one of several examples but as I said previously this is to illustrate the language concept more than to explain iOS table view controllers. The chapter on dynamic typing covers another of the less well understood Objective-C topics digging into messaging, selectors and runtime typing.

A key chapter in any book on Objective-C or Cocoa has to be the one on memory management. The authors explain memory management through object ownership and use that to introduce the retain/release methods (there is no discussion of garbage collection since this is an iOS book). Autorelease pools are covered as expected but so are memory zones which I confess I have never had to use with iOS. Overall this is a good explanation of a topic that most new iOS programmers struggle with. My only criticism is that you have to wait until chapter 9 for such a key topic to be covered.

Part 3 Advanced Topics

The final section of the book covers a number of advanced topics not all of which are really Objective-C language features. Having said that I think the chapter on NSError is not out of place as it covers why it is often used in Cocoa applications where other languages might instead use exception handling. The chapters on Key Value Coding (KVC), blocks and Grand Central Dispatch are all good introductions to complex topics which are becoming increasingly important for iOS developers.

The one topic that seemed slightly out of place to me was the one on Core Data. There is nothing wrong with the chapter, it is a good introduction to an important topic, I just think it would fit better in a book focussed on the Cocoa frameworks rather than Objective-C. The final chapter covers debugging with emphasis on detecting memory issues such as leaks and zombies. There is no mention of unit testing which would have been a nice addition.

Who Should Read This Book?

With so many books available all wanting to help you master iOS programming it can be difficult to recommend one over another.

I would recommend Objective-C fundamentals to people coming new to the language, perhaps without prior knowledge of C, who really want to master the finer points of the language. The only caveat is that you will probably want to start with a book that covers more of the Cocoa Touch frameworks and iOS development. This book is more suited to filling the gaps in your understanding of Objective-C rather than learning iOS. As such it is likely to be more useful to intermediate iOS developers rather than absolute beginners.

So to summarise this still may not be the first book I recommend you buy on iOS programming but it would make a good second follow up book for many people.

Thursday
Nov112010

Programming Ruby - The PickAxe Book

I am guessing that anybody who has even a passing interest in Ruby or Ruby On Rails probably owns the original Programming Ruby book (otherwise known as the PickAxe book) from Pragmatic Programmers. So I was pleased to see today that they have a special offer on the latest edition of Programming Ruby 1.9.

I have the original Programming Ruby version which covered ruby 1.8 and along with The Ruby Way it pretty much covers all my Ruby reference needs. I have been meaning to buy the upgrade to the new edition for a while but I never got around to it. The book has just been updated to cover ruby 1.9.2 and to celebrate 10 years since publication of the original version Pragmatic are offering the book for just $10 in either eBook or dead tree versions.

I always go for the eBook versions from Pragmatic as they are formatted really well. I use the pdf version to read from the computer and the ePub version to read on the iPhone using Stanza. The book normally sells for $25 so getting it for $10 is a bargain especially if you do not own the original (Pragmatic offer an upgrade from the previous version for $12.50 so the saving is not as big as it first seems for me).

It does not say how long the offer will last so if you are interested I would suggesting getting it while you can…

Tuesday
Sep282010

Design Patterns in Ruby

I just finished reading Design Patterns in Ruby and think it is worth a mention even if you are a dedicated iPhone developer. If you are regular Ruby developer you should definitely check it out. I should clarify that when I say I read this book I really do mean I read it from cover to cover which is not something I can normally say for a book on software.

I mentioned the excellent Cocoa Design Patterns books a while ago which looks at common design patterns in the Cocoa frameworks. This book takes a slightly different perspective in that it focuses on 14 of the classic software design patterns from the so called “Gang of Four” book - Design Patterns: Elements of Reusable Object-Oriented Software. This latter book has a reputation for not being an easy read whereas Design Patterns in Ruby is very well written by Russ Olsen.

The design patterns that the book discusses are as follows:

  • Template Method
  • Strategy
  • Observer
  • Composite
  • Iterator
  • Command
  • Adapter
  • Proxy
  • Decorator
  • Singleton
  • Factory Method
  • Abstract Factory
  • Builder
  • Interpreter

The patterns that are not included are generally those that do not find frequent use in Ruby. In addition, in a section that is much closer to the Cocoa Design Patterns book there are three additional chapters on patterns that are very common in Ruby:

  • Internal Domain-Specific Language (DSL)
  • Meta-programming
  • Convention Not Configuration

The book is written in a very readable style and I found it really increased by understanding of Ruby but also of when and how to apply common patterns in any language. The description of the Observer pattern for example is very easy to apply to the typical iPhone or Cocoa application.

I should also mention that the book starts with some good general advice on OO design and also a warning not to abuse design patterns by using them when it is not appropriate. Basically a design pattern is intended to solve a specific problem, applying a pattern to your code because you just read a pattern book and you want to try it out is likely to cause you some grief.

In Summary

If you have any interest in Ruby you should check this book out. Like the Cocoa Design Patterns book it is not an introductory book but if you are coming to Ruby from another language such as Java or Objective-C it can help you to start thinking the Ruby way.