module controller as single entry point
Posted: Wed May 07, 2008 10:18 am
Been thinking a lot about improving loose coupling in my structure. One of the ideas is this: given an url that maps to a module, a controller and action (eg forum/post/view/23), why not create a single point of access for the whole module.
Currently, if I understand things correctly, a module can have several controllers (eg postController, categoryController) each having different actions (eg postController->delete($id)). The frontcontroller calls these controllers based on some routing system.
What about a single forumController as point of access? The forum controller then decides what controller to instantiate. The advantage is that the system only needs this one access point thereby reducing coupling between parts. The disadvantage would be that the forum controller needs some extra work to determine what controller to instantiate, something which is repeated for the other modules.
Any thoughts on this?
Currently, if I understand things correctly, a module can have several controllers (eg postController, categoryController) each having different actions (eg postController->delete($id)). The frontcontroller calls these controllers based on some routing system.
What about a single forumController as point of access? The forum controller then decides what controller to instantiate. The advantage is that the system only needs this one access point thereby reducing coupling between parts. The disadvantage would be that the forum controller needs some extra work to determine what controller to instantiate, something which is repeated for the other modules.
Any thoughts on this?