Convention Over Configuration

Senthil Nayagan
2 min readDec 2, 2018
Photo by Cleyder Duque from Pexels

What is Convention over configuration?

Convention over configuration aka Coding by Convention is a coding philosophy or design paradigm that states that configuration should only be required when we’re doing something different. This approach reduces or eliminates the need for additional software configuration files.

The phrase essentially means a developer only needs to specify unconventional aspects of the application, for instance, if there is a class Sales in the model, the corresponding table in the database is called “sales” by default. If things deviates from this convention such as the table “product _sales”, one needs to write code/configuration to map the class name (Sales in our case) to database table name, product_sales.

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

Demerits

One criticism is that this approach making it hard for new starters on a project to understand how it works. Often the IDE’s support to “find all references” will return nothing when these conventions are being used because reflection is typically used at run-time to discover the methods to be called leaving developers wondering “how on earth does this even work?”

Generally speaking, the more appearing a convention is, the easier it will be for developers to learn and understand.

Conclusion

Conventions remove some problems, but may introduce others! So we need to understand the trade-offs in order to make a decision about what makes sense for us.

--

--

Senthil Nayagan

I am a Data Engineer by profession, a Rustacean by interest, and an avid Content Creator.