In most MVC frameworks, Controller class contains multiple methods, each representing one action. Then annotations and reflection is used to call those methods appropriately. But from OOP point of view, the whole class has many responsibilities, eg. one for each action. Then each action should be represented by it's own class.Does MVC framework that implements actions like this exist? And is there some kind of discussion that discusses pros and cons of both approaches?I believe it would be much cleaner to do it class-way, because it would allow simple extensibility through inheritance without need for annotations. But there would be 'overhead' of many more classes, making it harder to maintain the code.
MVC framework that uses classes instead of methods for actions
java;object oriented;.net;mvc
To make it clear, what you're talking about with expressing methods through classes is incarnated in the Command Pattern (http://en.wikipedia.org/wiki/Command_pattern).Many implementations of MVC pattern use the Command Pattern in order to turn the controller less monolithic. An example for an implementation in Java is avant (http://code.google.com/p/avant/).Well, from the OOP point of view, there are quite a lot of pros:Monolithic classes (many responsibilities) violate the Seperation of Concerns principle and the associated quality maintainabilityBy using the Command Pattern and its interface, it's easy to extend your controller by new commandsIf you'd like to implement something like an undo operation, you could as well do it with the command pattern easilyIncarnating methods to objects lay the groundwork for decoupling, since you can pass the command objects around and invoke them at the appropriate place in your programA small con exists though:The pros don't come for nothing: you have to write a class for each and every method, that's kind of overhead and might blur the application's big picture in huge applications