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?
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?
Lots of conventions here:
It's what you do when you find yourself solving a common problem in a particular style. You notice similarities and codify them into some automation scheme.
It means if you stick to certain coding conventions as defined by whatever convention-based framework you are using, you get a lot of functionality for free. In other words, if you structure your application in accordance to what the framework expects, a lot of work can be saved.
It would be a good idea to look up the advantages and disadvantages of coding by convention.
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.
In the context of Grails, "coding by convention" means that a lot of (tedious and repetitive) explicit code and/or configuration is replaced by simple naming and directory structure conventions. For example:
Coding by convention vs coding by configuration:
The idea that you have certain placing or naming conventions for stuff so you don't have to explicitly tell the program where stuff is or what it is called.
For example, in ASP.Net MVC there is a convention for where the views are stored and what they are called. This means that when your code instructs the server to return a view, the runtime will look for a view with a certain naming structure in certain folders. See page 20 in this pdf for more clarity.
Another example would be naming conventions for methods. For example, in an event-driven language you could have a choice to explicitly declare which method handles which events or you can rely on a naming convention - like ..._OnOpen or ...OnClick and then rely on the runtime to figure out the correct method to call for a given event.
See Convention over Configuration. It's the concept of designing a tool or framework to have the most common configuration options as the defaults, so for the vast majority of users no configuration is required.