views:

108

answers:

1

Which presentation patterns do you think Ext JS favors or have you successfully used to achieve high testability and also maintainability?

Since Ext JS component instances usually come tightly coupled with state and some sort of presentation logic (e.g. format validation for text fields), Passive View is not a natural fit. Supervising Presenter seems like it can work (and I've painlessly used it in one occasion). How about the suitability of Presentation Model? Any others?

While this question is specifically for Ext JS, it can apply to similar frameworks like SmartClient and even RIA technologies like Flex. So, if you have any first hand pattern experiences with any other web UI technologies, your input would still be appreciated.

+3  A: 

When thinking of presentation patterns, this is a great quote:

Separating user interface code from everything else is a key principle in well-engineered software. But it’s not always easy to follow and it leads to more abstraction in an application that is hard to understand. Quite a lot design patterns try to target this scenario: MVC, MVP, Supervising Controller, Passive View, PresentationModel, Model-View-ViewModel, etc. The reason for this variety of patterns is that this problem domain is too big to be solved by one generic solution. However, each UI Framework has its own unique characteristics and so they work better with some patterns than with others.

As far as ExtJS is concerned, in my opinion the closest pattern would be the Model-View-Viewmodel, however this pattern is inherantly difficult to code for whilst maintaining the seperation of the key tenets (state, view, model).

That said, as per the quote above- each pattern tries to solve/compartmentalise/simplify a problem/situation often too complex for the individual application at hand, or which often fails when you try and take it to its absolute. As such, think about getting a 'best fit' as opposed to an absolute when pattern matching application development.

And remember:

The reason for this variety of patterns is that this problem domain is too big to be solved by one generic solution.

Hope this helps!

Ergo Summary
Good point: not getting fixated on a generic solution.
Ates Goral