rokob

Eloquent Objective-C

31 May 2014

Category: code

Tags: code, book, objc, ruby

I recently made a transition from writing Objective-C all day to writing Ruby all day. Part of this transition was facilitated by many Ruby books as I discovered that the Ruby community is both very opinionated as well as well documented. It is delightful that people who use the language all do so in a way that stresses being idiomatic. This is very similar to Python's "one way to do it", but goes beyond merely how to solve problems to include whether one should write tests, how to document, etc. The best of the books on Ruby that I have used is called "Eloquent Ruby" by Russ Olsen. This book is not just a good Ruby book, it is one of the better books on programming that I have read in a while.

I think that Objective-C is missing this community primarily because the language is strangled by Apple, and therefore there is this assumption that everything one might need to know can be found in the SDK documentation. There are a handful of Objective-C books, the best one I am told is Effective Objective-C by Matt Galloway but I have not read it so I can't say one way or another. But there is a dearth of books similar to what Ruby has. There are also a few different styles for how people write code. The main style is defined by how Apple does things, how they suggest to do things, and how their code examples are written. This is why testing is rare, singletons are everywhere, etc. On the other hand, there is also a very vibrant and strong community of iOS and Mac OS developers. This leads to other styles being stated as the right way to do things. This is usually accompanied by much bike-shedding about tab stops and dot versus bracket syntax. I think the Objective-C community could benefit from a similar "Eloquent Objective-C" book to drive solid coding practices. I am not saying I am the right person to do this, but I have irrationally strong opinions so I won't mind giving it a shot.

I am going to give it a shot in a series of posts. I am just going to follow the Ruby book's structure. The first chapter is "Write Code That Looks Like Ruby" so we'll start there. This is probably the hardest one to write considering all of the opinions in the Objective-C community. I'll pick it up soon.

History -- 5416397e