Latest

Archive

Community news

C++

Communities and Content

Databases

Editorials

Emacs

General

HTML

Java

Notices

PHP

XML

Apache

C++

Database

General

HTML

Java

Javascript

Linux

Object oriented programming

Open source

Perl

PHP

Python

Ruby

SOAP

XML

Suggest a link

Advertise on zez

Contribute

Contact us

About zez


Coding Standards - Part 1 - Introduction



Coding standards define a standard for the look and feel of your code. This is helpful to most projects, and to some it is a necessity. Especially in open source projects.

About this article


The goal of this and the following articles is to show how coding standards will improve a development project. We use the C++ coding standard of eZ systems as an example of such a standard, but the concepts mentioned here are valid for and can be applied to many programming languages. We also use it for PHP development, wherever applicable.

What is a coding standard?


A coding standard is a set of rules describing how your code should look, which features of the programming language you will use and how, and possibly which tools should be used to write the code. It can of course be as specific as you want it to be.

Why is it good?


People are different. We like different things, wear different clothes, and use different styles when coding. This is fine as long as we just write small programs and scripts for ourselves. When many people collaborate on a project, the differences in coding style will lead to disagreements and poor readability which will hamper the cooperation and thereby the effectiveness of the project. An example of such disagreements is the simple, but widespread problem of indentation. How much indentation should be used? Where? Should we use spaces or tabs? There are probably as many opinions on this as there are programmers, and most of them are dead sure that their way is the right one. (The correct way of indenting C++ code is 4 spaces per level and no tabs, if you were curious. And, by the way, keep those curly brackets on a separate line, or you'll face at least seven years of bad luck and core dumps.) These problems are obvious in many open source projects where perhaps hundreds of people from all around the world develop software together, but it will soon become a problem in small projects and corporate environments as well. Even when you just write your own programs you will run into difficulties sooner or later, unless you use some kind of coding standard.


| < 1 > | 2 | Next page >> | Printer-friendly page |

Comment List


There are no comments.


Forgot your password?

Register a new user

Results

Polls