logoalt Hacker News

bitwizeshift • today at 8:14 PM • 11 replies • view on HN

I’m surprised I haven’t see anyone say this yet, but I don’t let the LLM design the code at all, I let it implement a design I have created.

By that I mean that, rather than let the LLM do the entire structure, I take the time to create the full hierarchy of abstractions and actors that I want my code to do. I decide, at the UML level, how abstractions will sit and interact — and then I make the LLM implement those gaps.

The key thing here is that, by doing this, I DO know how the code works. I may not know how each unit is implemented, but I know each unit’s responsibilities and how they interact with one another. I’ve found that LLMs are HORRIBLE at writing decent abstractions, regardless of how much prompting and skills I’ve given it. It will always get the job done, but it will often be unmaintainable and require bigger and heavier refactors as I introduce more and more requirement changes.

But by flexing my basic design skills, I don’t have those issues. Future refactoring fit into easy abstractions that I’ve designed. And by documenting it up front, I also have what becomes a living document on how this work will turn out.

It takes a few hours up front to plan ahead, but it makes the LLMs job easier and use less tokens, and it makes the code better long term. I don’t care if one unit is suboptimal, as long as the abstraction is right — because at worst I can change an implementation for a better one later.


Replies

fasterik • today at 8:42 PM

I agree with this approach, but I'm a bit surprised this has to be said at all. These are basic software design principles and I imagine it's the default way any experienced programmer would approach the problem. I wonder if the people not using this approach are primarily junior developers who have never seen how real software is built, or if it's leaking into the senior levels as well.

➕ show 4 replies
easterncalculus • today at 9:29 PM

> rather than let the LLM do the entire structure, I take the time to create the full hierarchy of abstractions and actors that I want my code to do. I decide, at the UML level, how abstractions will sit and interact — and then I make the LLM implement those gaps.

Do you do this with every repository that's brand-new to you? You refuse to, for example, use an agent to learn where the feature should generally live? This seems absurdly slow for that purpose, because even though humans can still get a deeper understanding of a codebase after several months, an agent can get a much deeper understanding over a timeline of the initial few days. Unless everything is already meticulously documented for you, I suppose.

➕ show 1 reply
smashed • today at 8:28 PM

Agreed. Even with opus 5.5 which everyone praises for its wonderful coding abilities, I keep catching awful coding abstractions or missing abstractions.

It can keep patching everything left and right whenever a new requirement comes up so it does not "need" to build abstractions, and it will only do it to please the human reviewer.

roadside_picnic • today at 8:31 PM

> I have created.

Are you working on a team? I've found that for solo projects this works but, even when you own the design of your piece, integrating with the work of several people doing this ultimately leads to even the part you initially designed no longer working exactly as you remember it.

A good chunk of my time now is spend working with an LLM to understand how other parts of the code base work and how they relate to and interact with the product features I manage. But I'm still on a small enough team that this is possible. I'm not surprised at all that an engineer at an org the size of Meta would not even be able to perform this level of work in understanding what's happening.

➕ show 1 reply
apinstein • today at 8:28 PM

Same here. I review plans w rendered diagrams. Data structures, flowcharts, uml sequences, and component architecture docs.

I have found that making the AI look the plantuml and the rendering and reviewing before presenting it to me results in much more legible designs. To me the peak of this would be a shared interactive whiteboard w the ai during design.

forestry • today at 8:18 PM

This is where myself and a colleague have settled. We design for longevity but it can still type, search, and debug faster than we can.

d1algo12 • today at 9:16 PM

LLMs certainly helps with designing and is the best brainstorming tool one can have beside their own brains.

mentos • today at 8:22 PM

Same. I let the LLM work inside a framework that I made.

Of course I only arrived at the framework after trial and error with an LLM showed me the shape of the problem and the framework presented itself to me.

eggplantemoji69 • today at 8:35 PM

This is too the paradigm I’ve settled upon after a year of using these tools.

➕ show 1 reply
j45 • today at 8:30 PM

Agreed, otherwise the risk is receiving the average of what LLMs think are best practice.

Planning is fundamentally so critical to ensuring alignment and outcomes, that over time how one plans can be better trained into the process to help do more and more of it.

ls-a • today at 9:44 PM

[dead]