Top 7 most used C++ idioms (Part1).

Idioms and design patterns are both common solutions to recurring problems in software development, but they differ in scope, granularity, and formality:

  1. Scope:
    • Idioms: Idioms are small, language-specific coding techniques or patterns that address specific programming challenges within a particular programming language. They often involve leveraging language features or conventions to achieve a desired outcome efficiently and effectively.
    • Design Patterns: Design patterns are higher-level, language-agnostic architectural solutions to common design problems in software engineering. They provide general reusable templates for solving design issues and promoting best practices in software design.
  2. Granularity:
    • Idioms: Idioms tend to be more granular and focused on specific coding constructs or techniques within a single programming language. They often involve manipulating language features or syntax to achieve particular goals.
    • Design Patterns: Design patterns are more comprehensive and deal with broader design concepts and relationships between components within a software system. They provide templates for organizing and structuring code at a higher level of abstraction.
  3. Formality:
    • Idioms: Idioms are typically informal and are commonly passed down through experience, code reviews, or programming literature within a specific programming community. They may not always have formal names or documentation.
    • Design Patterns: Design patterns are more formalized and well-documented solutions to common design problems. They often have recognized names, descriptions, and implementation guidelines outlined in literature such as the Gang of Four (GoF) book “Design Patterns: Elements of Reusable Object-Oriented Software.”
Continue reading “Top 7 most used C++ idioms (Part1).”