Advice: The actual code that runs at a join point — before, after, or around it. In aspect-oriented programming, advice is the code that runs at a chosen point in your program, called a join point. It can run before the original code, after it, or around it, in which case it decides whether the original runs at all.
A logging advice might record every call to a payment method. A transaction advice might open a database transaction before a service method and commit or roll back afterwards.
What should you keep in mind with Advice?
The idea shows up in many frameworks under other names. Laravel middleware runs around a request, and model events run before or after saving. These are all forms of advice. The trade-off is visibility. When behaviour is added from elsewhere, the function you are reading does not show everything that happens when it runs, so keep the amount of hidden behaviour small and well documented.
Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.