Embarcadero has just published on the docwiki site an updated version of the language style guide. The document has been updated to cover modern Delphi language features and some changes to the coding style
Over the last few months I drove an effort to publish a new Object Pascal style guide for today’s Delphi language. From the preface:
“This document is an updated version of the classic Object Pascal style guide, originally curated by Charlie Calvert for Borland at the time Delphi was originally released. The updated version has been curated by Delphi Product manager Marco Cantu, with contributions from the internal R&D team, Delphi MVPs, and the Delphi community at large.”
The text is not a language guide, rather it covers the use of white space and formatting when writing code — something the compiler generally ignores. Nothing is mandatory here, this is just a recommendation to favor readability. Following these rules is a requirement for our own internal team and any contributor.
You can find the style guide at https://docwiki.embarcadero.com/RADStudio/en/Delphi%E2%80%99s_Object_Pascal_Style_Guide
This is the document index:
- Introduction
- General Rules: Identifiers, Keywords, Indentation
- Source Code Files, Units and Their Structure
- White Space Usage
- Comments
- Statements
- Type Declarations
I’ll end this blog posting the short introduction:
While the Delphi compilers generally ignore any whitespace and allow for a lot of flexibility in the way a developer writes code, for readability and maintainability of the source code, Embarcadero has defined a set of guidelines used by the internal R&D and any developer involved with the project. We recommend the Delphi community at large to adopt this coding and formatting style.
The introduction of the original version of this document expresses this nicely:
“Object Pascal is a beautifully designed language. One of its great virtues is its readability. These standards are designed to enhance that readability of Object Pascal code. When developers follow the simple conventions laid out in this guide, they will be promoting standards that benefit all Delphi developers by using a uniform style that is easy to read. Efforts to enforce these standards will increase the value of a developer’s source code, particularly during maintenance and debugging cycles.”
This document does not refer to or explains the language syntax and grammar, as it is only focused on defining code writing style in places where the language gives you a choice, by allowing many different options in terms of whitespace and formatting.
None of these guidelines is set in stone and we expect them to evolve over time along with the language.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition
Awesome, thankyou kindly. Is it possible you could make it available as a PDF?
Wiki link is broken 🙁
There is (at the time of writing this comment) an issue with the DocWiki platform. Embarcadero are working hard to resolve it as quickly as they can. Sorry about that!
Any other place were I could download this guide?
That link is updated, and we will look at available elsewhere too.
I do not think this is the correct link, it is the technical document describing the language features. The old one was fairly small and was about things like naming conventions of variables, classes etc.
Yes I think you may be correct. I will try and see if I can track down the correct document and update the links here.
The was an issue in docwiki, the style guide page wasn’t available and (by mistake) we linked to a different language guide. it is resolved now, the link to https://docwiki.embarcadero.com/RADStudio/en/Delphi%E2%80%99s_Object_Pascal_Style_Guide above is correct