What Is Convention over Configuration?

Article Details
  • Written By: Alex Newth
  • Edited By: Angela B.
  • Last Modified Date: 09 August 2019
  • Copyright Protected:
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
Lyrebirds can imitate nearly any sound; in captivity, they have mimicked car alarms, crying babies, and chainsaws.  more...

August 18 ,  2005 :  The BTK killer was sentenced to 175 years in prison.  more...

Convention over configuration is a computer programming philosophy that usually makes it easier for programmers to design tables and elements based on a class name. When convention over configuration is used, only elements that go against the base class name must be written into the coding. Less coding is needed overall with this philosophy, and there generally are fewer spelling-based mistakes. Another advantage is that the configuration file that stores all the class names generally is smaller, which increases the coding’s speed and stability.

In the philosophy of convention over configuration, there may be one or several main classes used in the program, with sub-elements below it. For example, a program meant for tallying inventory may have a class named “Inventory.” Under this class, there may be tables and elements that have the same name but are distinct because of their function. This distinction means the programmer normally does not have to come up with unique or different names for each element, which can take time and can be difficult when there are many similar elements.


While using the same class name for every element is paramount in convention over configuration, there are times when the programmer will want or need an element to have a different name. This can be used to further distinguish the element or for a variety of other reasons. In this philosophy, only elements that are not named after the main class must be written into the programming; everything else is assumed to be named after the main class.

In terms of coding, convention over configuration often means less programming will be needed overall, because names do not need to be coded in. There also tends to be fewer problems with spelling mistakes, such as incorrectly naming an element, because fewer names are needed overall. Both of these make it easier for the programmer to create the software.

Functionality also is improved with convention over configuration because of a smaller configuration file footprint. Whenever a class or element name is placed in the programming, it also is stored in the configuration file so it can connect all the elements. A large configuration file often leads to a sluggish and volatile program, because there are many elements that need to be accounted for. If the file is small, then there is less to worry about and the software usually is better overall.


You might also Like


Discuss this Article

Post your comments

Post Anonymously


forgot password?