IT:AD:Patterns:Convention Over Configuration Strategy


Convention over configuration (also known as coding by convention) is a software design paradigm which seeks to decrease the number of decisions that developers need to make, gaining simplicity, but not necessarily losing flexibility.

The phrase essentially means a developer only needs to specify unconventional aspects of the application. For example, if there's a class Sale in the model, the corresponding table in the database is called “sales” by default. It is only if one deviates from this convention, such as calling the table “products_sold”, that one needs to write code regarding these names.

When the convention implemented by the tool matches the desired behavior, it behaves as expected without having to write configuration files.

Only when the desired behavior deviates from the implemented convention is explicit configuration required.

Src: Wikipedia.

  • Advantages:
    • Reduced development cost
    • Reduced training cost
  • Considerations:
    • For those who like knowing how things work, there is a bit of frustration, one has to spend extra effort delving into library code to understand what is going on.
      • In my grumpier days, I might even go so far as to grumble that those kinds of people are going to be displeased with whatever is written by anybody else but themselves, so why bother trying to please them anyway, and let them go fish? But that's just grumbling, right…
  • Disadvantages:
    • None