A coding style is a set of conventions on how to format code. For instance, what do you call your variables? Do you use spaces or tabs for indentation? Where do you put comments? Consistently using the same style throughout your code makes it easier to read. Code that is easy to read is easier to understand by you as well as by potential collaborators. Therefore, adhering to a coding style reduces the risk of mistakes and makes it easier to work together on software. Why Coding Style Matters is a nice article on why coding styles matter and how they increase software quality.

Figure 1:The Turing Way project illustration by Scriberia. Used under a CC-BY 4.0 licence. DOI: The Turing Way Community & Scriberia (2024).
Style Guides¶
Style guidelines differ between organisations, languages, and over time. Even the Python style guide Python Enhancement Proposal 8 (PEP 8) has had numerous revisions since it was released in 2001. You must choose a framework that is best for your purposes: be they for your benefit or the benefit of others. It is also important to remain consistent (and not consistently inconsistent)!
For example, PEP8 is the most widely used Python coding style and ECMAScript 6 aka ES6 is the scripting-language specification standardized by ECMA International for programming in Javascript.
For commonly used style guides for various programming languages see the Language Guides. Google also has a style guide for many languages that are used in open source projects originating out of Google.
Here are links to existing style guides for various languages:
PEP8 for Python.
Hadley Wickham’s style guide for R.
Google’s style guide for R.
Microsoft’s style guide for C#.
PEP7 for C.
Harvard Strategic Data Project coding style guide for Stata.
The Style Guide chapter in Data Management in Large-Scale Education Research provides examples for file naming, variable naming, and general code styling.

Figure 2:Point 7 of the Zen of Python is “Readability Counts”. (This can be printed with the python command >>> import this)
- The Turing Way Community, & Scriberia. (2024). Illustrations from The Turing Way: Shared under CC-BY 4.0 for reuse. Zenodo. 10.5281/ZENODO.13882307