开发者

Sharing UI validation across the application

I have seen couple of discussion on where to write UI validation in MVP.

There is quiet confusion over this as suggestion on keeping view and presenter. But displaying message box in prese开发者_如何学运维nter does not looks very good similarly putting logic in view restrict us from unit testing.

One more aspect is Sharing validation across the application. My thinking is to keep the UI validation in UI model by passing presenter. Even we could reuse this and also it reduces the size and complexity of the presenter. Handling in UI model looks more object oriented.

Is it right approach? Can you guide me on right direction?


The pattern is typically that all functionality should go in the presenter, that way it's reusable and testable. That doesn't mean you can't create some sort of validation display control to display them nicely.

Have a look at the way Silverlight RIA services does it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜