Live data from Hacker News

The Return of Aspect Oriented Programming

thomaswc.com

51–60 of 79 posts

Re: The Return of Aspect Oriented Programming

#51
I appreciate the potential power of AOP, but I'm grateful I never had to use it directly.

Rather, I got to rely on the special handling within, notably at the time, the Java JEE ecosystem. It was not "generic" AOP by any means, it was specialized. But I can say that what they did support was more than enough for my applications. I never felt I could use a more flexible framework.

I know some folks that did, the embraced it whole hog, and really got some power out of it. AOP could be used to make some very powerful constructs, especially adding dynamic behaviors to existing systems.

But that was simply never something I really needed in my Java work.

Re: The Return of Aspect Oriented Programming

#52

> And the "weaver", to use the AOP term, is simply the LLM that generates the program from the documents. Oh HELL NO. The LAST thing you want is a non-deterministic process monkey patching your code.

At the end of the day aren't we all just non-deterministic process monkeys patching code?

If you squint hard enough in ignorance, everything looks non-deterministic.

We need to stop the pseudophilosophy already. At this point, the AI bros think they have cornered some grand problem. If the universe is deterministic, then we can simulate it perfectly and humans and their other machines are all redundant. If the universe is non-deterministic, then stochastic AI "will eventually get better" and can replace humans too.

Have you considered there's something obviously missing with this reasoning, and you're wrong about this like the rest of us? This is not that profound.

Re: The Return of Aspect Oriented Programming

#53
Hadn't heard of AOP before, but funnily enough for a couple of years now I've been calling working with LLMs "aspective coding" - closer to switching context on different features. Will read up a bit more on AOP as it seems like the prior art on this way of thinking.

Re: The Return of Aspect Oriented Programming

#54

Putting aside the question of whether AOP is a good model for software systems development, I wonder if the specific approach proposed is a good model for LLM-driven software systems development. LLMs really like the most important context to be clustered in the most recent section of their window. Dividing up cross-cutting concerns into their own documents would seem to be pushing in the other direction.

Not necessarily. By handling certain aspects orthogonal to the main flow it reduces the context the llm has to keep track of and should enable deeper reasoning of the main functional logic.

Re: The Return of Aspect Oriented Programming

#55

Earlier quoted context omitted.

This is a retread of the 'animal-cat-dog' inheritance stuff we learned in our intro to OOP classes, where some people got together and put forward their own idea of programming as 'the way forward'. And me, like others have tried structuring our code like this, and failed, assuming the fault lay not with the idea itself but our skill level. Of course, by now it's kind of common knowledge that inheritance isn't a thin…

>it's kind of common knowledge If only.

In my experience it's mostly pushed by university professors that haven't worked in the industry since the 90s.

Re: The Return of Aspect Oriented Programming

#56
post #49
post #38

Earlier quoted context omitted.

I've feel like AOP is Spring on steroids. Same downside for both IMO.

I think that's a good point, never thought about it like that. I like the abstraction level that Spring Boot brings, but working with a principal engineer who was very into AOP on my previous team was a huge pain. Like you and GP said, AOP absolutely destroys readability. Current team has code split into a million xyz-common libraries, which isn't my preference, but I can still click through to see the source of the…

I think the issue is that a lot of concerns that appear to be "cross-cutting" at first glance, don't hold true to that design... but teams will try to stay the course, possibly due to existing debt, and it goes south pretty quickly from there. That's what I mean when I say there are some patterns that are obvious and proven cross cutting concerns (like logging), but there's really not a ton of them IMO, and if you're going to experiment with new potential concerns, then you must be ready to rip it up when it proves not to be the shape you thought it was.

Re: The Return of Aspect Oriented Programming

#57
post #31
post #2

My problem with AOP has always been that it makes the simple case trivial and the hard case much harder. Looking at transactions: The 99% solution is trivial: Every service call is a transaction. AOP can save me a few lines for every method and things look much cleaner. But then comes the huge excel upload that is performance critical. Batch more service calls to fetch additional information in the background, commit…

I always thought AOP was super cool, but also that it completely destroys readability and the ability to understand a codebase. I also think it's probably one of the worst concepts to embrace in the age of agentic coding. That would be like a foot missile. There are a limited number of patterns that absolutely do benefit from AOP though. The obvious one is logging. I don't think there's many though. Regardless, AOP i…

> destroys readability and the ability to understand a codebase.

Aha! That's exactly the sort of thing that can make code impervious to LLM AI.

LLMs have no grasp of any issues that are not visible in syntax, like concurrency. Code that has deadlocks or race conditions (because of other code not seen elsewhere) can look right, but be wrong.

In other words, if you write a program using convoluted spaghetti logic full of invisible data members and control flows injected remotely by aspects, LLMs trained on the code will have no understanding of it; they will just predict tokens according to the naive, visible code.

Imagine if all code out there available for training LLMs was heavily AOP. LLMs trained on it wouldn't be worth a damn. They would not correctly crib the entire solution: generate the code, and bring in the invisible aspects needed to actually make it work. All their solutions would just be the naive surface code that must be invisibly instrumented by half a dozen aspects to be complete.

AOP-heavy code would have to be somehow cleverly preprocessed for training in order for token prediction to do meaningful things with it.

Re: The Return of Aspect Oriented Programming

#58
post #15

After reading this post, I got curious and went back to read the original AOP paper. What the OP argued feels like just top-down design. These days, the term 'SPEC-driven' is trending, but it seems like just another word for top-down. They're probably just rebranding it because top-down has a negative image. Originally, AOP was about separating cross-cutting concerns by centralizing them in one place. It used weaving…

I went to an AOP talk by Kiczales back in 2005. When he presented join points as being driven by regular expression matches on identifiers (e.g. Get*: for all methods starting with Get) I decided to heckle. Knowing he has a Lisp background I brought up how Lisp teaches us that symbols should be treated as atoms; good programs don't break atoms apart. I think he made some Lisp joke and brushed it aside. But it's actually an incredibly bad idea.

- Want to add a new method? Maybe it's covered by an existing joinpoint expression and pulled into a pointcut, before you've even written it.

- Want to rename something? Where is it referenced? You can't just search for its name as a whole-identifier match, but must find every join point expression that could contain a regular expression match for it, and then filter out those whose other conditions don't match (wrong class, or whatever).

It is really hokey; and AOP tooling is possible without it, just more cumbersome.

E.g. we can have a special annotation which indicates that method is a joinpoint target, written somewhere on the method. That annotation can list the pointcuts to which it belongs. That becomes more maintainable. The reader of the code knows that since the method is a joinpoint, it interacts with certain pointcuts. They are listed by name, so you can jump to their definitions. When someone adds a new method to that class, they will see that the existing methods have this cruft on them, and decide whether to crib it, and how much. Just because the new method has a certain name doesn't mean it should be in those point cuts, or maybe not all of them.

Re: The Return of Aspect Oriented Programming

#59
post #15

After reading this post, I got curious and went back to read the original AOP paper. What the OP argued feels like just top-down design. These days, the term 'SPEC-driven' is trending, but it seems like just another word for top-down. They're probably just rebranding it because top-down has a negative image. Originally, AOP was about separating cross-cutting concerns by centralizing them in one place. It used weaving…

> So it's hard to talk about any 'oriented' approach because you have to specify which era's version you're referring to. For example, even with OOP, which everyone knows, ...

Ah, about that; regarding OOP, the "that problem has been solved" goes backwards in the revisions. Newer OOP breaks things. As in, "Ah, we have had that problem in Java since 2014, but did you know it was solved in Smalltalk 80". :) :)

Re: The Return of Aspect Oriented Programming

#60
I simply dislike AOP because it makes code much harder to follow. You suddenly have aspects which you need to be aware of at all times, worse aspects can interfere with each other in non-obvious ways. It breaks one of the core aspects of code, that you can do local reasoning.
Post reply on HN