Greetings,
I’ve worked on quite a few apps now that are using the MVC pattern be it in Rails or .Net and I always see a bit of private methods being added inside the controller class. These private methods are really knowing the “how” do validate something or the “how” to create a view model to a domain model. It seems to me that this logic is leaking and should be placed inside helpers or into the domain model itself. I always liked the phrase “A controller should know what to do, but now how to do it.” and it seems adding a bunch of private methods to the class breaks this.
I’m hoping someone has some useful insight into the matter.
Thanks!
I agree that this logic shouldn’t be part of the controller. I avoid private methods in my controllers. If we take the example of “how” to create a view model to a domain model this logic normally should reside in the mapping layer.