dimanche 22 juin 2014

How to split a controller

I'm looking for advice on the best way to split a controller class. After upgrading to SA 3.x the experience of navigating the controller class is awful because it is so slow. The controller is nearly 6K lines long and contains code to handle events and, of course, the logic of the application.

This seems to be an issue of file size as smaller files do not experience this degradation. So the question becomes: what's the best way to split up the controller class?


ExtJS5 may hold out promise as using the MVVM pattern may allow us to create clusters of logic which can reside in their own controllers. However, that's for another day as there are no plans to move to ExtJS 5 yet. ExtJS 4 works just great and the only need to think about touching the existing controller at all is to workaround the problem presented by SA 3.x


I've looked at using mixins to break up the controller however this is not satisfactory because then the controller code is in 'external' files. As a result, major sections of the application code would not benefit from the main advantage of using SA 3.x: code completion suggestions.


Creating a nested hierarchy of controller classes, each containing a subset of the controller functions might be another option. However, again, any such classes would have to be implemented outside SA which, again, defeats the purpose of using SA 3.x.


Is there some other mechanism I can use to achieve my goal without also sacrificing the ability to use SA?





Aucun commentaire:

Enregistrer un commentaire