Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Benefits of the "Convention over Configuration" paradigm

What are the benefits of the "Convention over Configuration" paradigm in web development? And are there cases where sticking with it don't make sense?

Thanks

like image 982
wassimans Avatar asked Dec 03 '10 15:12

wassimans


People also ask

What is the purpose of convention over configuration?

Convention over configuration (also known as coding by convention) is a software design paradigm used by software frameworks that attempts to decrease the number of decisions that a developer using the framework is required to make without necessarily losing flexibility and don't repeat yourself (DRY) principles.

Why is the concept of convention over configuration so important in MVC applications?

Hence, Convention over configuration helps developers to easily communicate with the ASP.NET MVC web framework by providing the pre-defined conventions, as shown in Figure-3 below.

What is convention over configuration in 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.

What is convention over configuration in Rails?

"Convention Over Configuration" means as long as you follow certain conventions you do not need to add additional configuration. For example, when you have a User model in your application then Rails assumes that it is defined in the file at app/models/user.


4 Answers

Convention states that 90% of the time it will be a certain way. When you deviate from that convention then you can make changes...versus forcing each and every user to understand each and every configuration parameter. The idea is that if you need it to differ you will search it out at that point in time versus trying to wrap your head around all the configuration parameters when it often times has no real value.

IMHO it always makes sense. Making convention the priority over explicit configuration is ideal. Again if someone has a concern, they will force themselves to investigate the need.

like image 165
Aaron McIver Avatar answered Oct 13 '22 01:10

Aaron McIver


I think the benefit is simple: No configuration necessary. You don't need to define locations for this-or-that type of resource, for example, for the app/framework to find them itself.

As for cases where it does not make sense: any situation where it will be fairly frequent that alternative configurations would be required, or where it makes sense that a developer/admin would need to 'opt-in' to some behavior explicitly (for example, to prevent unintended and unexpected side-effects that could have security implications).

like image 35
Andrew Barber Avatar answered Oct 13 '22 00:10

Andrew Barber


The benefit of convention over configuration paradigm in web development the productivity since you won't be required to configured to set all the rules and there are less decision that a programmer has to make. This is evident when using the .NET Framework.

like image 42
komoy Haye Avatar answered Oct 13 '22 00:10

komoy Haye


The most obvious benefit is that you will have to write lesser code. Let's take case of Java Persistence API. When you define a POJO having attributes and corresponding setters/getters, it's a simple class. But the moment you annotate it with @javax.persistence.Entity it becomes an entity object (table) which can get persisted in DB. Now this was achieved by just a simple annotation, no other config file.

Another plus point is, all your logic is at one place and in one language (i.e. you get rid of separate xml).

like image 25
rai.skumar Avatar answered Oct 13 '22 00:10

rai.skumar