Picture of Brian Love wearing black against a dark wall in Portland, OR.

Brian Love

Coding Conventions or Guidelines for Objective-C

When developing a framework, or when developing as part of a team, it is a good idea to have an agreed set of coding guidelines.

I strong believe this is important so that the code is consistent, providing everyone on the team with agreed-upon understandable code. As a creative individual, it is very easy for a developer to start hacking away, with little thought or intention to the code structure, style or typography. In my opinion, this often leads to a big ball of mud.

There are those that would say that getting a project done and out-the-door with the required functionality with as little time (cost) spent is a perfectly-good approach to software development. This approach can, and does, work for many businesses today. This is most often seen in small development shops, with often a solo developer who is developing an application for a client. They may intend on eventually washing their hands of the application, so the code design doesn’t really matter. Or, they are getting paid for the time spent to maintain the application in the future, and heck, more billable time is more money at the end of the day. So, why focus on coding conventions and guidelines?

Why?

There are several reasons to have a set of agreed-upon coding conventions/guidelines:

What Should the Guidelines Cover?

Coding guidelines should cover topics such as:

Apple’s Coding Guidelines

Fortunately for Objective-C developers, Apple has created a complete set of coding guidelines that spell out:

Here is a quick overview of their naming conventions: