Ruby and AOP: Decouple your code even more - Arkency Blog - 0 views
-
Dark Parts in our apps - persistence, networking, logging, notifications… these parts are scattered in our code
-
components are parts we can easily encapsulate into some kind of code abstraction - a methods, objects or procedures.
- ...16 more annotations...
-
Aspects cross-cut our application - when we use some kind of persistence (e.g. a database) or network communication (such as ZMQ sockets) our components need to know about it.
-
Aspect-oriented programming aims to get rid of cross-cuts by separating aspect code from component code using injections of our aspects in certain join points in our component code.
-
advice
-
what does it mean to “evaluate code around” something? In our case it means: Don’t run this method. Take it and push to my advice as an argument and evaluate this advice
-
use case is a pure domain object, without even knowing it’s connected with some kind of persistence and logging layer.
-
Aspect-oriented programming is fixing the problem with polluting pure logic objects with technical context of our applications.