Urgent.News

What's breaking now, across thousands of outlets.

Tech

Generators are All You Need

If you've been in development long enough, you know that one of the hardest parts of coding is building on top of existing code. I remember reading a statistic suggesting that starting a codebase from scratch is faster than building on an existing one. With AI, some of that has gotten better. But we also spend a lot of time forcing AI to work within the code we already have, and that comes with…

If you've been in development long enough, you know building on existing code can be challenging. A statistic suggests starting a codebase from scratch is faster than building on an existing one. With AI, this has improved somewhat, but forcing AI to work within existing implementation still poses problems. One area I encounter this is with open source, which I love but often deal with bugs, gaps in functionality, and unmaintained dependencies when used inside a company.

While it's reasonable to expect people to deliver what our company needs for free, we spend a lot of time trying to make those dependencies fit our codebase.

Code generators, which produce OpenAPI documents, internal APIs, or scaffolding for the rest of the application, are some of the most important tools we use. I spent a month trying to get code generators to work, using an AI to go through OpenAPI generators across every language. However, each one was missing something that prevented it from handling the full specification we needed.

My hypothesis was that coding agents, which can verify results, are well-suited for such tasks. Generators fit this well, as they have a specification, expected output, a contract to define behavior, and end-to-end tests to check the agent's progress. It took me an hour to build the generator, but it changed my perspective on using AI.

As these models become smarter, they may become very good at building things like compilers and generators. Even today, having an agent build a generator can be more efficient than writing and maintaining the code it produces.

We converted a large portion of our code to generated code, having an AI build the generators and use them to produce code from specifications. This has made maintenance easier, as the generators contain less code than the code they produce. We change the generator, regenerate the code, and the change carries through the rest of the codebase.

Repairing the generator is often more efficient than maintaining all the handwritten code. This approach focuses more on specifications and generators, using tests to ensure generated code meets expectations. I believe coding could end up looking like this, maintaining a collection of generators to produce the needed code. Defining the contract and ensuring tests cover it remains essential, but once verified, the agent can continuously test and refine the solution.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Destructive Identity Operations Explained: Login-Method Removal and Full User Deletion

Short answer: treat login-method removal as a recoverable credential change, but treat full user deletion as an irreversible, observable workflow that revokes every session before personal data is…

  • Login-method removal ensures removed authenticator can't start sessions
  • Full deletion prevents existing sessions from authorizing requests
  • Both operations have distinct postconditions and threat models

More from Wednesday 16 September →