Under the Bridge

Style guides

So, you ever looked at your project with old stuff and new stuff and samples borrowed from hither and yon and thought “sheesh, I seriously need to sort out a consistent style here?” Yeah, us too. So here’s a list of resources to help you out with that.

As always, start at the mothership and check out Coding Guidelines For Cocoa and The Objective-C 2.0 Programming Language.

Then, visit CocoaDevCentral for Coca Style For Objective-C, with a second part as well.

Got some strong opinions now? Good, it’s time to read through this thread on the possible pitfalls that await a poorly chosen strategy of variable naming.

And whether you agree with them or not, it would behoove you to be familiar with the practices in the Google Objective-C Style Guide, part of the google-styleguide project to document the practices used in Google code.

That we believe is a fairly comprehensive rundown of Objective-C focused resources, but then there’s the style of the non-objective bits of C and C++ that will probably be part of your projects as well; and there’s quite a bit more of that around. But a quite sufficient resource for that can be found at this archive of coding style documents. And if nothing you find there fits quite right, why, here is a generator for your own personal style document. We must find some time to play with that one of these days!

[EDIT: And for actively beautifying code, check out this post on use of uncrustify with Xcode!]

0