Application Services Best Practices: DOs and DON’Ts

less than 1 minute read

A list of quick design guidelines for application services.


  • Make them thin, they should not have heavy logic
    • Naturally, should not contain domain logic, but application logic
  • The application services are the part of your app that should contain most heavyweight integration logic (such as calling repositories or external services). This means their tests are going to be more complicated, likely integration tests. Therefore:
    • Keep the application methods straightforward; don’t allow branching (ifs) on them, so that a single (integration) test will suffice
    • If you have logic that implies branching, move them to external (standalone) functions, and test them in isolation. This allows you to test these with unit tests, which will make it easy to test all logic branches.

To be continued…

Leave a Comment