What are cross-cutting concerns?
As the lead-in to the chapter suggests, you might find yourself in your project with guidelines, formalized or not, that give you recipes for how to do things. For instance, to write a representational state transfer (REST) API that performs actions in your application, you might have a list of things defined that is there to help you remember what to do:
- Check authorization
- Check whether the input is valid
- Check whether the action is allowed as per business rules
- Add logging for the action
- Perform the action by calling the domain logic
- Translate the result from the domain to something digestible for REST consumption
- Remember to wrap the call to the domain in try {} catch {} and return the correct error
For each of these steps, there is always the risk that the developer will forget. This can pose a risk, cause security issues, data consistency, or other problems.
Personally, I’m a huge fan of automating...