Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is "coding by convention"?

Tags:

I've been looking at Groovy on Grails and noticed a line at the bottom that says:

Grails aims to bring the "coding by convention" paradigm to Groovy.

What exactly is coding by convention?

like image 591
Jason Baker Avatar asked May 23 '09 16:05

Jason Baker


People also ask

What is a convention programming?

April 2021. Coding conventions are a set of guidelines for a specific programming language that recommend programming style, practices, and methods for each aspect of a program written in that language.

What is meant by convention over configuration?

Convention over configuration is a design philosophy and technique that seeks to apply defaults that can be implied from the structure of the code instead of requiring explicit code.

What is convention over configuration in Maven?

Maven uses Convention over Configuration, which means developers are not required to create build process themselves. Developers do not have to mention each and every configuration detail. Maven provides sensible default behavior for projects. When a Maven project is created, Maven creates default project structure.

What does Convention over configuration mean spring?

Spring has always favoured convention over configuration, which means it takes up the majority of working uses cases into consideration and goes by it rather than nit-picking an exact configuration and dependencies required for a specific application development.


1 Answers

Convention over Configuration (aka 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 you are using matches your desired behavior, you enjoy the benefits without having to write configuration files. When your desired behavior deviates from the implemented convention, then you configure your desired behavior.

From "Convention over configuration" article on Wikipedia.

like image 60
Ivan Prodanov Avatar answered Sep 20 '22 17:09

Ivan Prodanov