1

The use case output port is called by the Interactor returning the response model, and the output port could be called many times with different responses.

Question: Could the output port has multiple methods and the response model divided into multiple response models one for each method?

I mean to do this

  interface UpdateProfileOutputPort {

  void userUpdated(UserResponse user);

  void updatingUserError(String requestError);

  void validationErrors(UpdateProfileValidationErrors errors);
}

instead of

interface UpdateProfileOutputPort {
  void execute(UpdateProfileResponseModel response);
}
class UpdateProfileResponseModel{
  UserResponse user;
  String requestError;
  UpdateProfileValidationErrors errors;
}
2
  • 2
    Of course it could. I assume your real question is "is this a good idea," or "does this conform to Uncle Bob's ideas for what a port should be?" Feb 21 at 14:04
  • The naming you suggest makes me think you might need event listeners rather than methods here.
    – Flater
    Feb 23 at 17:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.