Saturday, October 18, 2008

Delphi Programming style

Delphi it's really good IDE but it has some disadvantages. There no common universal code formatter. The programmers are very different in theirs coding styles, so it makes very difficult to develop the code together.

Legacy code
Reading legacy code sometime I think: "What the hell is that? How can it be able to write this!". Not all of the programmers know about codding standards and in the most cases it's not necessary. The one programmer can write the code any way one likes, he don't need to remember codding rules to understand old code.

Automatic source code formatting
When we have too much legacy code the manual reformatting becomes the heavy routine. I advise to use the GExperts for Delphi with DelForExp source code formatter. I'm using "Borland Style" predefined option and I like Borland code style it's really good for reading.

Team work
Team work is not so simple. Anyone want to write as he consider be better. But we can't build any kind of the Babylon tower...eh...big application speaking and writing in thousands languages. So we need to develop the codding standard for our team.

Codding standard
Let's try to define what we want.
Conventions for:
  • Unit naming
  • Unit structure
  • Identifier Naming
  • Commenting style
  • Declaring functions, procedures, classes, records, etc.

The next rules are not necessary, you also can define new rules and change, delete other rules.
This style developed on the codding styles listed in the articles:
  1. Identifier Naming Conventions
  2. Coding Standards and Conventions
  3. Coding Standard
  4. Delphi 4 Developer's Guide Coding Standards Document
  5. Стандарт стилевого оформления исходного кода Russian
For the next time I want to describe my codding standard based on this articles.

No comments: