jeudi 29 septembre 2016

Where to put business logic when using entity with MVP pattern

I have entities that are very dumb and only holds the data. I used to put some business logic inside the entities or presenter, i.e.

  • Movie.findMostWatchedTopTenMovies
  • Movie.hasWatchedThisMovie
  • TheatrePresenter.canScreenMoreMovies

(assume that these method contains some complex logic and it's not just getter)

but this seems against the SOLID principle and it's not test friendly code. So where is the most appropriate place to put this logic? And what should the class name be?

Aucun commentaire:

Enregistrer un commentaire