PresenterCallbacks and ViewCallbacks with JSF

47 views
Skip to first unread message

Milad Bourhani

unread,
Feb 7, 2014, 1:50:15 AM2/7/14
to clean-code...@googlegroups.com
Hi everybody,

I'd like to ask you a question about how to implement MPV+interactor using JSF. The code resides at https://github.com/miladhub/movie-manager-jboss7-masterslave/tree/master/movie-manager-web/src/main/java/movie (don't look at the ugly GitHub repo name..).

So, this is the callback interface implemented by the presenter and used by the interactor (I think it's been called PresenterCallbacks on this forum before; it's the interactor output port):
public interface FindMovieResponder {
  void matchesFound(Movie movie);
  void noMatchesFoundForCriteria(String searchCriteria);
}

This is the interface implemented by the View (the MVP View), which in JSF I implement with a Managed Bean:
public interface MovieView {
   void displayMatches(String matches);
   void displayErrorMessage(String error, String detail);
}

In particular, I've tried to keep the first use-case centric, speaking only the domain language (Movie, criteria), while the second tells how the presenter instructs the view on how to display things.

My main doubt is: is it worth it to have two levels of callback or it overkill / redundant? Maybe I should use return values?

The repository I linked also contains the implementations, I'd be much grateful if you guys would give me your opinions about this design.

Thank you all,
Milad

Reply all
Reply to author
Forward
0 new messages