Code Style
A code standard or style is a consistent, yet flexible, set of "best practices" designed to improve quality and readability while making code changes and maintenance easier. It:
- encompasses all aspects of code construction
- is designed to improve adaptation and maintenance
- does not form an inflexible set of standards
- is consistent
- is not "one size fits all"
- defines "best practices" for writing code
- must adapt to changes
A code standard is a set of conventions (sometimes arbitrary) about how to write code in a project. It is much easier to understand a large codebase when all the code in it is in a consistent style.
By ensuring a code style in your project you will get the following benefits: readability, program structure, programming practices, correctness, portability/interoperability, reusability, performance, and globalization/localization.
If you are unsure where or how to start, there is a lot of work in the community around standards for the most common languages, check here, pick one, and follow it.
When you and your team agree on the practice, don't forget to apply your code standard daily. You can configure your IDE to automatically check for non-standard code, install plugins and extensions, connect external tools to your CI/CD process, and even check it in your code review process.
Credits