3 ms·
> Makes it pretty much impossible to understand code by just looking at a single file. But note the irony there! The motivation behind AOP is to have separatio
by kazinator 3y ago
> Makes it pretty much impossible to understand code by just looking at a single file.
But note the irony there! The motivation behind AOP is to have separation of concerns. For each new requirement heaped onto to the system, we can ideally just write one new module (using AOP), so that that requirement's implementation is concentrated in one place.
Oh, someone wants logging for all the database calls? No problem; don't touch the database calls: let's write an AOP module which invisibly adds logging to them from a far. Then when you're looking at the database calls, you can pretend that logging of database calls doesn't exist (or not even know). When you do know there is such a thing, you have it in one place. Yay!
The thing is, why is it the database calls that are at the bottom? Because they were written first? Something has to get written without AOP in order for AOP to have something to hook into. One problem in AOP is that we can't start with an empty program, and then go through a list of concerns and implement them with AOP. It's just a kind of parasite that needs a host.
- hinkley 3y agoHaving too many concerns involved with a piece of code is the problem. AOC doesn’t fix that, it makes it more likely to happen. In the time since AOP, a lot more API designs have sprouted support for closures. That’s “around” semantics and the degenerate cases of around are before and after, which covers most of the space. Async/await fills in some of the remaining gaps.
- kazinator 3y agoSpeaking of around semantics, which brings me to the CLOS topic, I first learned about AOP in 2005 at a live presentation by Kiczales. He made disparaging remarks about Lisp and said that CLOS should be pronounced "see loss". Remember, that's the author of the Art of the Metaobject Protocol, and of the Closette project (portable implementation of CLOS-like object system).