General
- CamelCase is used to indicate different parts of a name.
- Underscores are used for the MCU’s register addresses, bits, and values.1
- Modules begin uppercase.
- All exported items begin uppercase (but see RECORD fields).
- CONSTs begin uppercase.
- TYPEs begin uppercase.
- RECORD fields begin lowercase, even if exported.
- VARs begin lowercase (unless exported).
- Exported PROCEDUREs begin uppercase, local (non-exported) ones lowercase.
- PROCEDURE parameters begin lowercase.
- If a part of the CamelCase-ed name is an all-caps acronym, then the next part begins lowercase, such as
SPIdev
, to preserve the acronym.
Remarks
- I prefer local procedures to start lowercase, since this way I know when reading code if a procedure is part of the module API.
- Naming exported items should take into account that they will always be referred to qualified by their module name. For example,
UARTdev.Device
, notUARTdev.UARTdevice
. - Some exceptions due to the Oberon tradition: writer and reader variables are usually
W
andR
, respectively.