logo
Kurashizu Blogwhere ideas flow
  • Home
  • News
  • Blog
  • About
  • Home
  • News
  • Blog
  • About

© 2026 Kurashizu. All rights reserved.

Admin·New Post·Service Status
Powered by Cloudflare·03.11.26
← Back to news

The Return of Aspect Oriented Programming

Original article
thomaswc.com|23 points|16 comments|by thomaswc|Jun 25, 2026

The Renaissance of Aspect Oriented Programming

When developing software, a programmer's mental overhead is staggering. They aren't just writing logic; they are juggling a massive array of competing priorities. We can represent this cognitive load as a summation of concerns:

Total Cognitive Load=∑i=1nConcerni\text{Total Cognitive Load} = \sum_{i=1}^{n} \text{Concern}_iTotal Cognitive Load=∑i=1n​Concerni​

The Programmer's Checklist

To ensure a professional result, a developer must constantly verify the following:

  • Correctness: Does the code actually fulfill the business requirements? Are the invariants maintained?
  • Efficiency: Is the resource usage (CPU, RAM) minimized?
    • Note: This includes avoiding memory fragmentation and meeting strict real-time deadlines (e.g., response time<0.2s\text{response time} < 0.2sresponse time<0.2s).
  • Debuggability: How hard is it to fix when it breaks?
    • It requires a consistent internal and external style.
    • Unit and integration tests must be viable and helpful.
    • Execution traces and variable states must be available for monitoring and statistics.
  • Security & Authorization: Users should only perform actions they are explicitly permitted to do.
  • Privacy: Data must be shielded from unauthorized eyes, including the system owners, unless specified.
  • Extensibility: The architecture should allow for minor modifications without cascading failures.
  • Dependency Management:
    • Legal compliance with external licenses.
    • Version compatibility (e.g., resolving conflicts when Lib A needs Lib C v1 but Lib B needs Lib C v2).
    • Ensuring third-party code doesn't compromise any other goals on this list.
  • Deployment: Adapting the code for different environments via containerization or environment-aware logic.
  • Real-time Monitoring: Providing external interfaces for health checks in long-running processes.
  • Lifecycle Management: Handling the complexities of stopping and restarting applications.
  • Input Validation: Ensuring incoming data is sanitized and correctly formatted.
  • Error Handling: Implementing graceful degradation, alerting systems, and state recovery.
  • Internationalization: Supporting multiple languages and regional requirements.
  • Accessibility: Ensuring the software is usable by people with diverse physical or mental capabilities.

Beyond the code, the developer also handles non-technical burdens like writing code estimating timelines and coordinating with teammates.


What is Aspect Oriented Programming (AOP)?

In the mid-1990s, Gregor Kiczales and his colleagues at Xerox Parc proposed a solution to this fragmentation. They suggested that programming would be far more efficient if we could isolate these "concerns" and handle them individually rather than intertwining them in every single line of code.

The Old Way: The Join Point Model

The original implementation of AOP relied on the join point model. This functioned essentially as a runtime pattern-matcher for the program's call stack.

For instance, a programmer could define a rule: Whenever a "file open" routine is pushed onto the stack, trigger a logging event to record the filename.

"This approach is remarkably similar to the COME FROM statement—a legendary programming joke—making it a nightmare to maintain and debug."

The Failure of the Original Model

The traditional AOP approach was revolutionary brittle. Because it relied on matching specific string names or function signatures, it was prone to failure.

Example of the fragility:

// The AOP weaver looks for "open_file()"
void open_file(string path) { 
    /* logic */ 
}

// If a coworker adds this, the AOP logger misses it!
void open_system_file(string path) { 
    /* logic */ 
}

A New Vision: LLMs as the Weaver

With the emergence of Large Language Models (LLMs), AOP can be reimagined. Instead of runtime stack matching, the "weaving" happens during the generation phase.

The Proposed Workflow

  1. Separate Documentation: The programmer writes distinct documents for each concern (e.g., a "Security Document," a "Style Guide," and a "Correctness Document").
  2. Variable Lengths: The correctness doc will be extensive, while the style guide might be a brief set of rules.
  3. Reusability: An organization can reuse the same maintainability.md across ten different projects.
  4. The LLM Weaver: The LLM reads these disparate documents and synthesizes them into a single, cohesive codebase.

Comparison of AOP Eras

FeatureTraditional AOPLLM-Based AOP
MechanismRuntime join point matchingGenerative synthesis
StabilityBrittle (string/signature based)Semantic (intent based)
MaintenanceHard to trace executionManaged via source documents
ImplementationComplex compiler/runtime hooksPrompt engineering / LLM

AOP Concept

The fundamental flaw of the previous era was that if a coworker added a new file open...