PDA

View Full Version : Implementation class or controller



raanan
5 Feb 2012, 11:01 PM
Hi,

In the last few days I've been working with Designer 2.0 beta and I'm very pleased with the new version that enables you to prepare the entire MVC basic structure throw it.

The only thing that I couldn't understand is what are the differences between the Implementation Class and the Controller classes in an Ext JS MVC application.
Them both have the same comment "You should implement event handling and custom methods in this class", and looks like they meant for the same purpose.

Currently I prefer to use the controller, and the implementation class is just an empty wrapper in my MVC application (located under view directory and wrap the classes located under view/ui).

What is the right approach?

Thanks for any clarification answer.

aconran
6 Feb 2012, 12:17 PM
raanan -

There is no cut and dry answer to one being right and the other being wrong. It depends on the situation.

For example, if you have a formpanel that has a checkbox and as it is checked it progressively discloses more information then that behavior/logic would probably belong in the implementation class. This is because it is self-contained in that form and is not interacting with external components.

However lets say I have a button that opens a new Window. That behavior probably belongs in a controller as it is interacting with an external component/subclass.

Both of these approaches are correct, and its highly dependent on your situation. This really boils down to an architectural decision.

raanan
6 Feb 2012, 9:41 PM
I understand.

Thank you for your answer.