You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In fact, controller deals with multiple objects: Movie, Movies::Creator, Movies::Updater and Movies::Presenter. It feels like breaking Rails naming conventions. Usually we would expect that MoviesController deals with Movie.
Luckly, methods Movies::Creator#execute and Movies::Presenter#execute accepts the same parameters as Movie#update_attributes, but it is not clear why this happened. Problem that I see here - we need to change multiple classes if we will change Movie model, for example add new attribute "studio".
Every object in the MoviesController has specific public interface (it is clean to understand until we don't have many other controllers with their own specific objects).
In general this code style looks like breaking of standard Rails "conventions over configurations", that brings all the power of fast development. May be it would be better not to use Rails at all? There are some other frameworks that offers similar way to organize a code base, for example Hanami
PS. Sorry for posting this as Issue, but I did not found comments on the blog page :)
The text was updated successfully, but these errors were encountered:
Hi there! First of all thanks for the blog post and this example of code!
I have some doubts about the MoviesController
In fact, controller deals with multiple objects:
Movie
,Movies::Creator
,Movies::Updater
andMovies::Presenter
. It feels like breaking Rails naming conventions. Usually we would expect thatMoviesController
deals withMovie
.Luckly, methods
Movies::Creator#execute
andMovies::Presenter#execute
accepts the same parameters asMovie#update_attributes
, but it is not clear why this happened. Problem that I see here - we need to change multiple classes if we will change Movie model, for example add new attribute "studio".Every object in the MoviesController has specific public interface (it is clean to understand until we don't have many other controllers with their own specific objects).
In general this code style looks like breaking of standard Rails "conventions over configurations", that brings all the power of fast development. May be it would be better not to use Rails at all? There are some other frameworks that offers similar way to organize a code base, for example Hanami
PS. Sorry for posting this as Issue, but I did not found comments on the blog page :)
The text was updated successfully, but these errors were encountered: