How do you organize your controllers?
Posted: Wed Oct 21, 2009 10:22 pm
Asssuming you use classes and actions map to methods.
Do you partition your controllers by the type of data they return, such as:
At what point do you use conditional checks in the actions themselves to determine what data to output, for instance would you have a separate AJAX controller or would use use the HTML controller and conditionally check whether to return only the body section or the entire layout and everything?
The primary force pushing me in this direction, is the fact I have managed to factor much of the redundant code into individual base controllers, so deriving one monolithic controller after each sub-class doesn`t make sense, when only one action method requires the functionality in base controller XYZ. Using composition in this regard just feels dirty and doesn`t lend itself to elegant design.
What says youÉ
Cheers,
Alex
Do you partition your controllers by the type of data they return, such as:
Code: Select all
MyController_Html
MyController_Json
MyController_Rest
MyController_SoapThe primary force pushing me in this direction, is the fact I have managed to factor much of the redundant code into individual base controllers, so deriving one monolithic controller after each sub-class doesn`t make sense, when only one action method requires the functionality in base controller XYZ. Using composition in this regard just feels dirty and doesn`t lend itself to elegant design.
What says youÉ
Cheers,
Alex