What is Quality C++?
Quality C++ is a living knowledge base that aims to provide a central point of reference of actionable advice for crafting high quality C++ code.
Code quality is the degree to which code can be safely and efficiently changed to meet user needs. This frames quality not just as correctness or adherence to rules, but as the capacity of code to evolve efficiently without causing unwanted side effects. In practice, this means writing code that is reliable, maintainable, and adaptable to user needs.
What is Software Quality?
Section titled “What is Software Quality?”Quality is commonly defined as fitness-for-purpose. Software has the purpose of being valuable to its users. But users’ needs change, requirements evolve, and features must be added or adjusted to remain valuable over time. Change is central. This makes the software’s ability to adapt quickly a key aspect of its quality.
Analogies help explain code quality by comparing it to everyday domains where cleanliness, maintenance, and professionalism are expected parts of the job
Read more: Software Quality
Key Characteristics and Techniques
Section titled “Key Characteristics and Techniques”Below are core techniques and guidelines that contribute to high-quality C++ code. Each reduces risk of error or makes change easier:
A Starting Point: Selected Guidelines
Section titled “A Starting Point: Selected Guidelines”Safety and Correctness
Section titled “Safety and Correctness”- Use const correctness to improve code safety and clarity
- Use Static Analysis to guard correctness and consistency
- Take warnings seriously
Readability and Clarity
Section titled “Readability and Clarity”- Extract conditions into descriptive functions
- Use Type Aliases to improve readability
- Avoid creation of objects that are not in a usable state
Managing Change and Complexity
Section titled “Managing Change and Complexity”- Write code that reads like the problem that it solves
- Make intentional design decisions
- Avoid just-in-case programming
- Prefer value semantics over reference semantics
Design and Architecture
Section titled “Design and Architecture”- Design code toward library quality
- Prefer looser coupling over tighter coupling
- Improve testability by extracting hard to test code
Process and Workflow
Section titled “Process and Workflow”- Use small and isolated experiments to resolve uncertainties
- Be familiar with the C++ Core Guidelines
There is much more to explore. Browse the full collection using the sidebar, or follow the links between related pages to discover connected ideas.
If you found this knowledge base useful, consider giving back — with money, feedback, or sharing.