This all about an API that registers the users of a web application.
It is designed to practice how to identify the different responsibilities in the code and decouple them.
There are two main objectives:
- Part 1: decouple the code from the Framework used.
- Part 2: decouple the code from Database and Libraries.
- Run the tests.
- Do not write Business logic on the Controllers → Instead move ALL the logic to a Use Case class.
- Do not use the Inputs of the Framework as arguments of your Use Case class.
- Create your own exceptions to handle errors.
- Do not use the Framework response as the response of your Use Case class.
For the second part of the exercise you need to repeat this 4 steps for each coupling:
- Define an Interface using Dependency Inversion Principle.
- Evolve your legacy code to match the Interface.
- Create an adapter that implements the Interface and uses the Library.
- Remove the coupling with the infrastructure (Database and Libraries) injecting the collaborator.
Using your IDE
Luis Rovirosa @luisrovirosa
Jordi Anguela @jordianguela