Convention over Configuration (CoC) <TAG1> is the principle that the system or framework already has default configurations, allowing the developer to avoid writing/creating settings themselves. This greatly reduces the number of decisions to be made and reduces the time for customization and development in general.
For the first time, this approach gained popularity thanks to the framework Ruby on Rails. Rails is based on the idea that most developers will perform similar tasks in similar ways. Rails therefore provides typical solutions such as file structuring, model names, controllers and databases. If you follow the accepted agreements (conventions), the system automatically configures many aspects of the program. For example, a model named Article will automatically match the articles table in the database, without the need for additional configuration.
This frees the developer from the routine configuration. Exceptional cases where individualization is required are easily configured separately, but the main scope of tasks can be performed faster using predetermined conventions.
Getting rid of overconfiguration allows you to focus on the logic of the program, not on the settings. This speeds up development and reduces errors, as fewer configurations mean fewer places where bag can be. At the same time, this approach can be found outside of Rails. Many modern frameworks and tools use a similar — approach from JavaScript libraries to infrastructure management systems.
CoC is one of the key approaches to simplifying the development process, where applications that comply with established agreements require minimal configuration, and the developer gets more freedom to create functionality instead of working with small settings.
Example CoC (RoR)
Let's take a closer look at the CoC example to understand exactly where we save time and reduce the likelihood of bugs due to the added custom code.
The developer creates a model <TAG1> for example, the Article model in Rails.
Since Convention over Configuration involving the use of agreements (conventions), Rails automatically expects the table for this model to be called articles (standard plural for English nouns).
Rails automatically connects this model to the articles table in the database, without the need for additional settings. If the agreement is suitable, no additional configuration is required.
This approach frees from redundant configuration, as the system relies on typical settings.
If in simple words, the framework already has general configurations that you don't need to invent yourself, but you just need to follow the conventions so that everything works "right out of the box".