tags:

views:

37

answers:

1

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 presenter 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?

A: 

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.

Doobi
Thanks Doobi.I got the answer, but my question is bit different. We have added UI model to process Application logic, can we call these UI model directly from View ? As my assumption is we could test and reuse the UI model even though we are not passing through Presenter. Advantage of this is it reduces complexity and type check in presenter. Hope I am clear.
Ganapati