4. Move all logic that won't be called by unrelated actions/components to a module saved in the plugins directory. - This option is better than 3 because I can preserve MVC + cake structure while achieving my organization and encapsulation. The fact that this module will never be used elsewhere doesn't seem to matter all that much.
I hope to get some feedback. Thanks On Nov 18, 1:31 pm, Josh <[email protected]> wrote: > Hello, > > I have a bit of an organization problem I am coming up against, and I > wanted to see how other developers have handled similar problems. > > I have a controller action with lots of supporting private functions > in the controller. There are also several components used by this > action. I have this situation appear a few more times throughout my > App and sometimes twice in one controller. It inevitably crops up when > doing significant AJAX processing. > > Before I go any farther in development, I am going to reorganize these > classes and methods so that there is greater logic encapsulation in my > controllers and better organization of my components. I have few > ideas, and I wanted to see if others have ideas too. I am sure many of > you have dealt with this before. > > Possible solutions: > > 1. Move the action and supporting methods to a new controller without > a model > - I don't like this because I have a complex data model and > therefore a lot of controllers. I don't want to clutter my controller > directory nor ignore the spirit of the controller as logic for a > specific model. > > 2. Move the controller action and supporting methods to a component. > And, perhaps move this class and related components to a subdirectory > of the component folder. > - I don't like this because either the components file will be > cluttered with lots of components or lots of subdirectories. Also > these components would undermine the spirit of the component as a > supporting logic for an action. > > 3. Move the the action and supporting methods to it's own folder and > class in the vendors folder, with supporting classes in a > subdirectory. > - I like this option the most, because I get the encapsulation of > logic and the organization of the file structure while adhering to the > conventions of the controller and component. > > What solutions have other people come up with? > > Josh -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cake-php?hl=en.
