GridDyn Style Guide
June 5, 2026 ยท View on GitHub
The goal of this style guide is to describe the naming conventions we want to
use for developing GridDyn. This guide is adapted from the HELICS developer
style guide so the two projects follow the same conventions where practical.
Formatting conventions are primarily enforced through the repository
.clang-format and .editorconfig files.
Naming Conventions
-
All free functions should be
camelCasestd::shared_ptr<GridDynSimulation> makeSimulation(const std::string& fileName);Exception: when the functionality intentionally matches a standard library function such as
to_string. -
All classes should be
PascalCaseclass GridSimulation: public GridArea { public: GridSimulation(); }; -
Class methods should be
camelCasevoid setTime(CoreTime newTime);Exception: methods that intentionally match standard library naming.
-
Enumeration names should be
PascalCase. Enumeration values should beCAPITAL_SNAKE_CASEenum class SolverPrintLevel { ERROR_TRAP, WARNINGS, DEBUG_OUTPUT }; -
Constants and macros should be
CAPITAL_SNAKE_CASE -
Variable names: local variable names should be
camelCasemember variable names should bemPascalCasestatic const members should becamelCasefunction input names should becamelCaseindex variables can becamelCaseor short forms such asii,jj,kkglobal variables should begPascalCase -
All C++ functions and types should be contained in the
griddynnamespace with subnamespaces used as appropriatenamespace griddyn { ... } // namespace griddyn -
C interface functions should begin with
griddynXXXX -
C interface functions should be of the format
griddyn{Class}{Action}orgriddyn{Action}if no class is appropriate -
All CMake commands that come from CMake itself should be lower case
if as opposed to IF install vs INSTALL -
Public interface functions should be documented with Doxygen-style comments
/** get the identifier for an object @param obj the object to query @return a string with the object identifier */ -
File names should match class names where practical, especially for new code and files renamed as part of cleanup work
-
User-facing options should use a single canonical spelling expressed as
nocase,camelCase, orsnake_case. Do not support multiple synonymous names for the same option.
Migration Notes
GridDyn contains a substantial amount of legacy code that predates these conventions. New code should follow this guide immediately. Existing code should be migrated incrementally, with changes grouped into small, reviewable refactors that preserve public interfaces unless the rename is intentional and coordinated.