Naming conventions: Difference between revisions
From LimeSurvey Manual
No edit summary |
(No difference)
|
Revision as of 23:10, 18 January 2013
Having moved to a (partial) MVC architecture we should adopt some conventions for naming our models and controllers.
The folks at cakephp (http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html#model-and-database-conventions) came up with some nice naming conventions.
I suggest we use these for new concepts we introduce to our architecture.
In short:
- Models are singular: Plugin not Plugins.
- Database tables backing the model are plural, lowercase: plugins, not plugin or Plugins.
- Controllers are plural if they are "directly" backed by a model: PluginsController, not PluginController.
- Controllers are singular if they are not backed by a model: AdministrationController (which we shortened to AdminController)
- Controllers backed by a main model handle most stuff related to that model. This modularization makes it easy to find the code we are interested in when bugs need fixing.
I realize that functionally naming conventions don't have any benefit, however they do increase maintainability. Currently we don't have naming conventions (or I am unaware of them AND they have not been consistently obeyed in the current code base).