Presentation patterns to use with Ext

前端 未结 2 1108
别那么骄傲
别那么骄傲 2021-02-06 04:34

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

Since Ext compon

相关标签:
2条回答
  • 2021-02-06 05:24

    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 Ext is concerned, in my opinion the closest pattern would be the Model-View-Viewmodel, however this pattern is inherently difficult to code for whilst maintaining the separation 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.

    I hope this helps!

    0 讨论(0)
  • 2021-02-06 05:29

    2 yeas have passed since this question was aksed and now Ext-JS 4 has a built-in implementation of the MVC pattern. However, instead of an MVP (which I prefer), it favors a straight controller because the views attachment themselves to the models through stores.

    Here's the docs on the controller:

    http://docs.sencha.com/ext-js/4-1/#!/api/Ext.app.Controller

    Nonetheless it can be made to act more like a supervising controller. One nice aspect of Ext-JS is the global application objects ability to act like an event bus for handling controller to controller communication. See this post on how to do that:

    http://www.sencha.com/forum/showthread.php?176495-How-to-listen-for-custom-events-fired-in-application

    Of course the definitive explanation of all these patterns can be found here:

    http://martinfowler.com/eaaDev/uiArchs.html

    0 讨论(0)
提交回复
热议问题