Skip to content

Multiple Application Service Methods per Class #17

@boedy

Description

@boedy

Hi, Thanks for your awesome book! I have a question:

On page 306 your say:

Using a dedicated class per Application Service makes the code more robust against external changes (Single Responsibility Principle). There are fewer reasons to change the class, as the Service does one and only one thing. The Application Service will be easier to test, seeing as it does less things. It’s easier to implement a common Application Service contract, making class decoration easier (check out the chapter on transactions in Repositories). This will also result in higher cohesion, as all dependencies are exclusively dedicated to a single use case.
The execution method could have a more expressive name, like signUp. However, the execute Command pattern186 format standardizes a common contract across Application Services, thereby enabling easy decoration, which comes in handy for transactions.

How would you handle viewing " one wish" vs e.g. "All whishes"? Would this be:

  1. Two separate classes for the two use cases
  2. One class; Two methods
  3. One class; logic handled in the execute method based on parameter / request obj
  4. Another option?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions