Sign in Join
Wiki copytemporary

DesignGuidelines: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: DesignGuidelines

OldNewLine
1+## Coding Guidelines for Lazarus
2+
3+Coding style
4+
5+- Since one style is easier to read, Lazarus follows the [CodeGear Coding Style Guide](http://edn.embarcadero.com/article/10280) lines. Of course, almost anyone will find some points there, that are arguably less readable than other styles. That's OK, just try to follow at least 90%. See the LCL for examples.
6+- Try to avoid unit cycles (uses section in implementation sections). Reasons: 1. FPC has problems with them. 2. This allows to split units and packages when they have grown big.
7+- Minimize the number of calls from Interfaces to LCL, when performing an action requested by the LCL. The interfaces only notify the LCL, never force something. The LCL decides.
8+- Naming convention: see [[Nomenclature]]
9+- All code must work with all checks (range, I/O, overflow, stack) on. Apart from the fact that this helps debugging, some users put these checks into their fpc.cfg, so they are applied to whole Lazarus - including packages and examples.
10+- Names in comments: Comments should help the reader. They are not for the glory of the writer. You can add a name if you are the maintainer aka get the bug reports assigned or if the name is a good search term to find help on this topic.
11+
12+New files
13+
14+- Every file should start with a header containing the license and a few lines describing the content.
15+- Pascal sources should have lowercase filenames (.pas, .pp, .inc, .lfm, .lrs). You can use CamelCase for unit names.
16+
17+Include files
18+
19+- should start with the {%MainUnit } directive
20+
21+Packages
22+
23+- should have an .lpl entry in packager/globallinks/
24+- should have an author, description and license
25+
26+Main Menu Items
27+
28+- Should have a key in keymapping.pp
29+
30+------------------------------------------------------------------------
31+
32+*The authoritative version can be found in [svn](http://svn.freepascal.org/svn/lazarus/trunk/docs/DesignGuidelines.txt). Proposals for improvement can be added to talk page (discussion)*.
33+
34+### GUI
35+
36+See [[GUI design guidelines]]
37+
38+## See also
39+
40+- Free Pascal (FPC) coding standard (used for the compiler and other FPC code): [[Coding style]]
41+
42+---
43+*From the Free Pascal wiki, page "DesignGuidelines", as it stood on 2020-04-15 after a change by Jwdietrich, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
44+Category: Coding guidelines
45+Category: Coding style
46+Category: FPC
47+Category: Guidelines
48+Category: Lazarus

Back to history