This is an AI generated text, a ChatGPT question with an answer that is just too interesting to throw away. My question was something like: When using AI to generate code we will be significantly more productive and therefore end up with a much bigger codebase. How do we architect our systems so that we can maintain the increased amont of code? The answer I got describes a paradigm shift, identifying a very different way of working with systems development.

1. Less “code as text,” more code as structure

When AI can generate thousands of lines instantly, raw text becomes the wrong abstraction.

Architectural shift

  • Move from hand-written logic → declarative specifications
  • Define what the system should do, not how line by line
  • Examples:
    • Infrastructure-as-Code
    • Policy engines (rules, constraints)
    • Data schemas + contracts
    • Workflow/state machines

Effect

  • AI generates implementation details
  • Humans review models, invariants, and boundaries
  • Code becomes a compiled artifact, not the primary design medium

2. Strong modularity + contract-first design

If code volume explodes, comprehension becomes the bottleneck, not generation.

Key principles

  • Very small, well-defined modules
  • Strict interfaces (types, schemas, APIs)
  • Contracts enforced at runtime and compile time

Architectural implications

  • Microservices or modular monoliths with:
    • Explicit inputs/outputs
    • Versioned interfaces
    • Compatibility checks
  • AI can regenerate internals safely as long as contracts remain stable

Analogy

Think of modules as replaceable organs, not intertwined tissues.


3. Generated code is disposable

A big mental shift: most AI-generated code will not be “maintained”.

Instead

  • Treat generated code as:
    • Cached output
    • Build artifact
    • Regenerable implementation

Architecture supports

  • Clear source of truth (specs, tests, prompts, constraints)
  • Regeneration instead of refactoring
  • Diff-based trust is replaced by property-based validation

Result

  • Less fear of deleting large chunks of code
  • Maintenance effort shifts upward to specs and tests

4. Tests and invariants become the real product

As code quantity increases, tests become more valuable than code.

Architectural response

  • Extremely strong automated testing layers:
    • Property-based tests
    • Fuzzing
    • Simulation environments
  • Formal-ish constraints:
    • Invariants
    • Assertions
    • Runtime guards

AI is good at generating code.
It’s less good at violating constraints that are machine-checked.

So architecture evolves toward

“Everything is allowed unless proven unsafe.”


5. Layered autonomy (human ↔ AI boundaries)

You’ll see architectures that explicitly define who is allowed to change what.

Example layers

  • Core safety logic → human-reviewed only
  • Business logic → AI-generated, human-approved
  • Glue code / adapters → AI-generated freely

Mechanisms

  • Code ownership rules
  • Change budgets
  • Risk-based review thresholds

This mirrors how safety-critical systems already work—but scaled.


6. Tooling becomes architectural, not just supportive

IDEs, CI, and repos will evolve into active architectural enforcement systems.

Expect:

  • AI agents that:
    • Continuously refactor to architectural rules
    • Enforce layering and dependency constraints
    • Reject code that “looks correct but violates intent”
  • Architectural linting at system scale

Architecture moves from diagrams to live constraints.


7. The return of high-level system design

Paradoxically, more AI-written code increases the value of classic architecture skills.

Humans focus on:

  • Domain modeling
  • Failure modes
  • Trade-offs
  • Long-term evolution paths
  • Socio-technical boundaries

AI handles:

  • Boilerplate
  • Variations
  • Mechanical transformations

A concise mental model

Think of future systems as:

  • Specs (human-defined intent)
  • Constraints (machine-enforced rules)
  • Generated implementations (AI-produced, disposable)
  • Continuous validation (tests + monitoring)

Code volume can grow without collapsing complexity only if architecture moves up a level of abstraction.

Links

When sharing the above I got the following interesting links on the same subject:

On the same theme, but better described: https://medium.com/@craig_32726/agile-is-out-architecture-is-back-7586910ab810

A detailed example of code generation: https://gist.github.com/bemafred/3654d1e988ebfcf2c5d5433d7450049b

1 comment

Leave a Reply

Discover more from Christina Ljungberg

Subscribe now to keep reading and get access to the full archive.

Continue reading