[TYPO3-ect] Subcontrollers

Elmar Hinz elmar.DOT.hinz at team.MINUS.red.DOT.net
Mon Jun 11 21:16:33 CEST 2007


Hi all,

we have now gathered our first experiences with the lib/div architecture,
of what model, views and controllers are, what is their strengthes and
difficulties. In spring there has already been a short discussion about
hooks, services and subcontrollers.

Maybe you have observed that I did a big clean up of the controller class.
The main function is really short now. With this it is prepared for
improvements. I want to get some input for concepts of subcontrollers from
you. 

Do you ask, what a subcontroller is? Our plugin is a subcontroller
to the overall TYPO3 main controller. Other plugins in our page are
subcontrollers as well. Within a more complex plugin you need further
deligation of tasks. We end up with a tree of controllers. You could
compare this with the processes tree of your operating system. Each
subcontroller has a parent controller. Each subcontroller can have child
controllers.

Again we work on our virtual touristic portal as object of our
considerations. We want to display a town and a list of the hotels within
this town. So we have a single view with a related list view. We could use
two different plugins that work together, but for our discussion we assume
that the list of hotels is displayed directly within the plugin of the
town. We want to generate it with a subcontroller. There are other lists
related to the town: shops, routes, restaurants, etc. So we need more
subcontrollers.


I can imagine two different concepts but I don't know the official names.


1.) Model tree here, view tree there:

In this concept the model first collects all related list data using
submodels, wich are implemented as subcontrollers. Then the bunch of data
is handled by the main controller to a big view, wich renders all the data,
maybe using subviews.

Advantage: More easy to understand for a beginning programmer.
Advantage: More easy to handle for designers, cause all can be done
within one template.



2.) Tree if MVC nodes:  

Here each subcontroller handles model and view upon it's own. It is
autonom. It simply returns the rendered HTML string in the end to the
parent controller. Each node has a full functional set including model,
view, templates. Our list of hotels could be generated and used even
without the single view of the town and without the other lists.

Advantage: Modularity and flexibility.
Advantage: More easy to manage by experienced developers.
Advantage: Programming of loops to handle data between model and view may
be reduced.


So what is your feeling about. What are your exeriences with comparing
systems?

Regards

Elmar


More information about the TYPO3-team-extension-coordination mailing list