Darwin  1.10(beta)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Coding Guidelines

"Software is written for people, not for machines." — anon.

The key to successful (large) programming projects, like any other project, involves planning, management, and testing. The amount of time, effort and emphasis placed on each of these three components depends on the size of the project, the expected/desired outcomes, and the experience of the people involved. Consistency in design and implementation is also key to success, especially for ongoing software projects, and is what we will address in this article by outlining some (fairly standard) coding conventions that are used in the Darwin project. These conventions will make the project more manageable over time especially when many different people are involved.

It is absolutely guaranteed that some users will not like the style guidelines, and that others will even hate them. Everyone has their own style which they prefer to use on their own projects. As Grace Murray Hooper once said: "The great thing about standards is that there are so many of them to choose from." However, as part of a collective effort, your team-mates, as well as yourself, will benefit greatly from the uniformity that a fixed set of style guidelines offer.

Finally, since the Darwin framework is designed to be platform-independent, it is essential that you make don't implement any platform specific functionality (or atleast provide generic implementations for other platforms). Following these guidelines will help reduce the amount of incompatibility introduced by developing in multiple environments.

Finally, before writing a new class or function, check to see whether one already exists that does what you want, or nearly what you want. Can that function be generalized to meet your needs? However, before making changes to library functions, think about how these changes will affect code alreay using these functions.

Source Control

Structure

Variable and Object Naming

Comments

Portability and Maintainability

Performance

Miscellaneous

Testing and Debugging