HN Debrief

The Return of Aspect Oriented Programming

  • Programming
  • AI
  • Developer Tools

The post tries to rescue aspect-oriented programming, or AOP, by reframing it for the LLM era. Instead of classic AOP tools that inject behavior at runtime through pointcuts and weaving, it suggests writing separate documents for concerns like logging, transactions, or auth, then letting an LLM merge those concerns into the program. The pitch is that this could reduce duplicated boilerplate and let teams reason about features from cleaner, higher-level specs.

If you are experimenting with spec-driven or agentic coding, keep cross-cutting behavior explicit and mechanically checkable. Treat any proposal that hides control flow behind an LLM or runtime magic as a debugging and reliability risk until it proves otherwise.

Discussion mood

Strongly negative. People remember AOP as a source of unreadable, hard-to-debug ghost behavior, and the idea of replacing deterministic tooling with an LLM made that history sound even riskier.

Key insights

  1. 01

    Compiler plugins worked in narrow verticals

    Using attribute-driven compiler plugins on C++ classes showed the value and the limit of this whole family of ideas. It saved boilerplate and lowered cognitive load inside tightly defined domains like UI windowing, but combinatorial interactions and poor debuggability killed it once the scope widened. That history sharpens the current proposal because it suggests the win is real only when the extension surface is narrow and the generated behavior is predictable.

    Use this pattern only for bounded domains with fixed conventions. If your concern can combine freely with many others, expect the maintenance cost to swamp the boilerplate savings.

      Attribution:
    • quatonion #1
  2. 02

    Classic AOP was more static than advertised

    AspectJ was not just runtime pattern matching bolted onto Java. Its join point model tried to define principled integration points, calculate what could be resolved statically, and leave only the dynamic residue for runtime. That matters because the post attacks a caricature of old AOP, while the harder question is whether LLM-era tooling can match the inspectability and type awareness that even older AOP systems attempted to provide.

    Do not compare an LLM-based weaving idea against the worst version of runtime proxy magic. Compare it against compile-time interception, type-checked effect handling, and other explicit mechanisms that already solve part of the problem.

      Attribution:
    • w10-1 #1
  3. 03

    Name-based pointcuts are the real footgun

    Matching join points through identifier patterns like "Get*" makes semantics depend on naming accidents. Add or rename a method and you may silently change behavior without touching the call site or the aspect itself. That is a stronger critique than generic readability complaints because it pinpoints why many AOP systems felt unmaintainable even with good intentions. The suggested alternative was explicit annotations on target methods so the relationship stays visible and navigable.

    If you need interception, prefer opt-in markers at the definition site over broad pattern matching rules. Make the affected code advertise that it participates in the mechanism.

      Attribution:
    • kazinator #1
  4. 04

    Concern-specific views may help more than weaving

    The promising part of the idea is not hidden code injection but better ways to present code and specs one concern at a time. Several comments pointed toward filtered code views, syntax highlighting, folding, or temporary stripping and restoring of clutter like internationalization wrappers so models can reason over a smaller surface. That keeps semantics grounded in the source while still giving both humans and agents an "aspect" view when they need one.

    Invest in tooling that derives alternate views from explicit source of truth. That gets most of the cognitive benefit without paying the cost of hidden behavior.

      Attribution:
    • mncharity #1
    • 6gvONxR4sf7o #1
    • twoodfin #1
    • heisenbit #1
  5. 05

    Modern language features already absorbed part of AOP

    AOP never fully disappeared. Many of its legitimate use cases got pulled into more disciplined tools such as effect systems, functional composition, middleware, interceptors, and compile-time hooks. The common thread is that the cross-cutting concern survives only when the host language can express it explicitly enough to preserve reasoning and verification. That makes a full AOP revival look less like a comeback and more like a search for better syntax around ideas that already migrated elsewhere.

    Before adopting an AOP-style framework, check whether your language already has an explicit feature for the same job. Native effects, middleware, decorators, or functional wrappers are usually easier to reason about and easier to review.

      Attribution:
    • azkalam #1
    • dionian #1
    • jerf #1
    • TuringTest #1

Against the grain

  1. 01

    Specialized AOP still earns its keep

    Used narrowly, AOP remains a practical escape hatch for large Java and .NET systems. Interceptors, middleware, framework transactions, and compile-time variants like Micronaut AOP can remove repetitive plumbing or avoid invasive refactors when the concern is genuinely cross-cutting and the tooling is mature. That does not redeem AOP as a general architecture style, but it does explain why it never fully died inside enterprise stacks.

    Do not ban the category outright if you run a large framework-heavy codebase. Reserve it for a short list of stable concerns and prefer the most explicit, compile-time, framework-supported option available.

      Attribution:
    • peterabbitcook #1
    • whartung #1
    • pjmlp #1
    • dragonwriter #1
    • rjbwork #1
    • guybedo #1
    • amarant #1
  2. 02

    A new language could make this cleaner

    The idea becomes more credible if aspect behavior is part of the language and compilation model instead of an after-the-fact weaver glued onto an existing language. Languages already surface some machine-oriented structure through effects, lifetimes, regions, and intermediate representations. From that angle, the proposal is less crazy as a language design direction than as a retrofit for Java, Python, or other mainstream stacks.

    If you want to push this frontier, prototype it as a language or compiler experiment, not as invisible magic inside an existing production codebase. That is where you can enforce guarantees instead of hoping conventions hold.

      Attribution:
    • jerf #1
    • w10-1 #1

In plain english

AOP
Aspect-oriented programming, a style that tries to separate cross-cutting behavior like logging or transactions from core business logic.
AspectJ
A well-known aspect-oriented extension for Java that adds pointcuts, advice, and weaving.
join point
A specific place in program execution, such as a method call or exception, where an aspect can attach behavior.
LLM
Large language model, an AI system trained on large amounts of text that can generate and transform language and code.
Micronaut
A JVM framework that includes compile-time dependency injection and aspect-oriented features, aiming to avoid some runtime overhead of Spring-style approaches.
Spring
A popular Java application framework whose AOP and proxy mechanisms shaped many developers’ experience of aspect-oriented programming.
weaver
The part of an aspect-oriented system that inserts aspect behavior into the target program.

Reference links

AOP frameworks and implementations