[thelist] Coding standards....

Hassan Schroeder hassan.schroeder at gmail.com
Thu Dec 7 10:10:38 CST 2006

On 12/7/06, Chris Ditty <cditty at gmail.com> wrote:

> Can a few of you share your coding standards?

At the top of the list:

Descriptive and *consistent* naming conventions. A lot of the need for
comments disappears if you have truly meaningful variable and method
names. If you have an object named UserData, name the method that
accesses it "getUserData", not "getUserInfo" or "getData".

Make sure this spans the *entire* app, no exceptions: CSS classes and
ids, HTML form field names, URLs, mid-tier programming, directory names,
database names and fieldnames. Everything.

Documenting that the mid-tier object "orgID" actually refers to a database
field named "org_num", when that database *also* contains a field named
"org_id", is simply madness.  [  A Real Life(tm) example :-)  ]

While less critical, code formatting standards (tab size, brace placement,
order of import statements) do make scanning unfamiliar code easier.

If you're keeping separate documentation, do it in *plain text* and keep
it in your source control (CVS, Subversion, whatever); much easier to
diff out changes, much easier to update.

That's a start... :-)

Hassan Schroeder ------------------------ hassan.schroeder at gmail.com

More information about the thelist mailing list