MENUREADME | How to run locally | REST API doc | Web app screenshots
Eighteen versions (gradually implemented) of a Web and REST API app made with Ruby on Rails that aims to get the most out of the MVC/Rails Way.
| Branch | 031-resources-within-namespaces_base-controllers |
| Lines of Code | 1355 |
| Rubycritic Score | 91.56 |
In the branch 021-multi-controllers-per-entity_rest_actions_only, the TaskItemsConcern was introduced to share code among the task item controllers.
However, as with the previously introduced namespaces, this version introduces the concept of base controllers to replace the concern usage. This way, the controllers within a namespace can have specific (more cohesive) parent classes.
See below how the task controllers are organized:
app/controllers/task ├── items │ ├── base_controller.rb │ ├── complete_controller.rb │ └── incomplete_controller.rb └── items_controller.rbTask::ItemsController < Task::Items::BaseController Task::Items::CompletedController < Task::Items::BaseController Task::Items::IncompleteController < Task::Items::BaseControllerSince the previous version, we can see that the Rubycritic score has remained the same, which is positive given that the improvements in the structure do not complicate the existing implementation.
Although the score has not changed, we can see how this grouping reduces the effort to understand and find your way around the code. This also translates into increased cohesion, not at the class level but at the namespace level (groups of classes and modules).
The cohesion ideas (organization and grouping guided to a specific purpose) will be applied to views and partials. Check out to see the benefits of this approach.
Next version: 032-resources-within-namespaces_partials-grouped-by-context.
To understand the project's context, I'd like you to please read the main branch's README.
Check out the:
- disclaimer to understand the project's purpose.
- summary of all branches.