与 Ext 一起使用的表示模式 [英] Presentation patterns to use with Ext

查看:25
本文介绍了与 Ext 一起使用的表示模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您认为 Ext 喜欢或已经成功习惯了哪些展示模式实现高可测试性和可维护性?

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

由于 Ext 组件实例通常与状态和某种表示逻辑(例如文本字段的格式验证)紧密耦合,因此 被动视图 并不自然适合.Supervising Presenter 似乎可以奏效(我曾在某个场合轻松使用过它).演示模型的适用性如何?还有其他的吗?

Since Ext 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?

虽然这个问题是专门针对 Ext 的,但它也适用于类似的框架,如 SmartClient 甚至 RIA 技术,例如 Flex.因此,如果您对任何其他 Web UI 技术有任何第一手模式经验,我们仍然会感谢您的意见.

While this question is specifically for Ext, 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.

推荐答案

在考虑表示模式时,这是一个很好的引用:

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

将用户界面代码与其他一切都是关键原则精心设计的软件.但它不是总是很容易遵循,它会导致应用程序中的更多抽象这很难理解.相当许多设计模式试图以此为目标场景:MVC、MVP、监督控制器,被动视图,演示模型,Model-View-ViewModel等原因对于这种各种各样的模式是这个问题域太大了由一种通用解决方案解决.但是,每个 UI 框架都有自己的独特的特征,所以他们使用某些模式比与他人.

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.

就 Ext 而言,在我看来,最接近的模式是模型-视图-视图模型,但是这种模式在保持关键原则(状态、视图、模型)的分离的同时很难编码.

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.

记住:

原因对于这种各种各样的模式是这个问题域太大了由一个通用解决方案解决.

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

我希望这会有所帮助!

这篇关于与 Ext 一起使用的表示模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆