Tuesday, March 29, 2011

Comment Design in iOS

As both a programmer and UX/UI designer, I'm a big believer in making sure the inside is designed as well as the outside -- a practice that Apple follows religiously with its hardware design.

One aspect of "inside" design is the use of comments in code. While there is no single right way to use comments, here are some key guidelines to consider:

1. Consistency: No matter what style you use, make sure it's consistent throughout all your apps. If you manage a team of programmers, an agreed-upon commenting style may be beneficial.

2. Minimal Formatting: Use only the minimum formatting required to ensure clarity and ease of editing.

3. Reflect Hierarchy and Importance: Make sure a comment that heads an entire section is designed diferently than the subheads within that section. Also, if you have important comments, make sure those comments are visually distinctive enough so they stand out when scrolling through code.

4. Pragma Marks: Instead of using comments to highlight places where code needs to be bug fixed, use pragma marks. XCode indexes pragma marks to make it easy to jump to specific points in your code.

No comments:

Post a Comment