Why do you need a controller?

Topics: Web Client Software Factory
Jan 4, 2009 at 7:37 PM
I'm following the Labs for the WCSF and I don't see why we need to add an extra layer with the controller?  Isn't enough the Presenter to handle the work and call the Model.  I'm sure there is a good reason, please give me direction on this and hopefully point me in a direction where I can read more about.  Working with the factories and patterns is awesome but you MUST understand the mindset behind it to be able to produce good implementations in real world.

Thank you
Jan 5, 2009 at 5:37 AM
Jan 5, 2009 at 3:00 PM



The controller “layer” is not always necessary and, if you want, you can write all the code in presenter classes. The controllers are used as a common place to define shared functionality/methods between your presenters to avoid code duplication. Additionally, controllers are useful to manage and centralize the page flow and screen navigation logic. If you have the page flow logic and screen navigation implemented in views’ code-behind and/or presenters , you must change the source code of all the views/presenters to change the page flow.

Perhaps you could find useful the following article in the WCSF documentation about the Application Controller pattern:

·         Application Controller


There is not any recipe in the WCSF’s Guidance Package that creates a presenter using a controller class (the Add Business Module recipe creates a controller class per module). To get an instance of the controller, you can follow the steps described in the following article:

·         How to: Use a Module Controller from a Presenter


Please, let me know if you find this useful.


Ezequiel Sculli