PDA

View Full Version : Using a plugin as a controller - pros and cons



_uknownot
3 Sep 2014, 9:23 PM
I want to build a plug-in that will act as the "controller" for my view component - instead of using traditional extjs mvc architecture. Pros and cons to this approach?

A vague question, I know, but what do you think of the idea?

slemmon
8 Sep 2014, 10:01 PM
If the plugin's logic is intended to be component-level logic for all instances of that component then a plugin makes sense. If it's intended to handle application-level logic I'd stick with separating the view and the handling of logic / interactions into a controller used by the component.

jay@moduscreate.com
10 Sep 2014, 6:19 AM
If the plugin's logic is intended to be component-level logic for all instances of that component then a plugin makes sense. If it's intended to handle application-level logic I'd stick with separating the view and the handling of logic / interactions into a controller used by the component.

I echo Seth's comment. I'm also going to add that what you want to do does not jive with the way plugins were designed (beginning Ext JS 2). The plugin initially was designed to be like what mixins are like for classes but tailored specifically for UI components.

Application-level logic shared across controllers should be shared via Mixins.