I have a Presenter ( RoomPresenter
) and a Model ( RoomModel
). My RoomModel
have some methods like:
void createRoom(RoomData roomData, List<User> users)
void addUsersToRoom(int roomId, List<User> users)
void joinRoom(int roomId)
This is the createRoom()
implementation:
void createRoom(RoomData roomData, List<User> users) {
addUsersToRoom(roomData.getId(),users);
joinRoom(roomData.getId());
}
So, when the user wants to create a room, ( abstracting the View -> Presenter methods call) the presenter will call the createRoom()
method of the RoomModel.
My question is: Would be a good practice make the presenter, and not the model,implement the createRoom method? (i.e. the presenter will have the createRoom()
and the model will have just the addUsersToRoom()
and joinRoom()
methods). Because in that way, I'll be able to call some View methods (e.g. show a toast or a loading status) before or after calling the addUsersToRoom()
and joinRoom()
methods.
createRoom
is somewhat inappropriate if you want it to also trigger something in your View. Are you intending to tiecreateRoom
into a specific button press (or other input command) on your View? If so, perhapsonCreateRoomButtonPressed
makes more sense?createRoom()
, I would rename the method toonCreateRoomButtonPressed()
because it would make much more sense since we're talking about the Presenter.