Category: 

What Is Convention over Configuration?

Article Details
  • Written By: Alex Newth
  • Edited By: Angela B.
  • Last Modified Date: 05 September 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
Roughly one-fifth of the world's stock of gold - worth over $200 billion USD - is stored under the streets of London.  more...

September 30 ,  1949 :  The Berlin Air Lift ended.  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.

Ad

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.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

exception 'Exception' with message 'error writing captcha: Duplicate entry '2147483647' for key 'PRIMARY'' in /ssd/www/wisegeek/public_html/_core/classes/public/Captcha.php:44
Stack trace:
#0 /ssd/www/wisegeek/public_html/_core/controls/public/ControlDiscussionPostBox.php(324): Captcha->createCaptcha()
#1 /ssd/www/wisegeek/public_html/framework/classes/Control.php(104): ControlDiscussionPostBox->preRender(false)
#2 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): Control->render()
#3 /ssd/www/wisegeek/public_html/tpl/default-nocustom-lu/pages/public/article/article.htm(526): Control->__toString()
#4 /ssd/www/wisegeek/public_html/framework/classes/Control.php(300): require('/ssd/www/wisege...')
#5 /ssd/www/wisegeek/public_html/framework/classes/Control.php(309): Control->requireTpl('pages/public/ar...', Object(PageArticleCom), true)
#6 /ssd/www/wisegeek/public_html/framework/classes/Control.php(131): Control->renderTpl('pages/public/ar...', Object(PageArticleCom))
#7 /ssd/www/wisegeek/public_html/framework/classes/FormDataControl.php(87): Control->renderTemplate()
#8 /ssd/www/wisegeek/public_html/framework/classes/Control.php(109): FormDataControl->renderTemplate()
#9 /ssd/www/wisegeek/public_html/framework/classes/ScriptPage.php(50): Control->render(false)
#10 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): ScriptPage->render()
#11 /ssd/www/wisegeek/public_html/framework/classes/Page.php(97): Control->__toString()
#12 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(443): Page->processRequest()
#13 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(7): PublicFrontController->renderPage()
#14 /ssd/www/wisegeek/public_html/index.php(11): PublicFrontController::run()
#15 {main}