Hacker News new | ask | show | jobs
by davepeck 47 days ago
A friend of mine sometimes jokes that code is “fractally busted” when it’s wrong at every level, from single lines all the way up to the design of the system’s main interfaces.

That’s also roughly what I find after a long English-only session with a coding agent. Our conversation covers a lot of ground... and leaves out details at every level. When I look at what got built, the misunderstandings are fractal too.

I agree it’s important to design it yourself, but UML is only one level. Lately I’ve been using a scratch Python file (or even a scratch repo) that Claude and I both edit. Never mind that I’m writing Rust. Python reads like pseudocode, and pass and ... (Ellipsis) let me skip whatever I don’t care about. At any level where I do care, I can say exactly what a method’s signature should look like, what fields a domain model should have, or how it should maintain key invariants. Everywhere else I leave an ellipsis, maybe a docstring, and let the agent decide.

It works both ways: I ask the agent to sketch the current system in Python, with some details elided and others spelled out. Then I edit the sketch and have the agent push the changes back into the much bigger Rust+Tauri app.

Time will tell whether this approach has legs, but when I want to be precise, I find it sometimes pays to just write some code.

4 comments

This is the way. I can write pseudo code (ie Python) and I leave a breadcrumb trail of comments where I want it to implement. Hell the code doesn’t even need to have valid syntax if you forgot some function signature, but that small amount of guiding can produce significantly better results than a blind implementation from the model.

I’ve also tried spending an hour or two first before handing over control. That way there’s something pre-existing it can work from.

I don't have this experience at all. My workflow is:

* Bite sized jobs, about what you would expect for a traditional user story.

* 10-15 minutes discussing the implementation. It's almost the exact same conversation I would have with a human engineer. I'm almost entirely asking questions - "How would you do Xyz? What about this problem? What about that problem?"

* At the end of the conversation, both the AI and I have a good understanding of the problem and the solution.

* I say "do it".

* There are occasions when I don't fully understand what it wants to do. I'll tell it to do the work, then we discuss it afterwards. Sometimes we change things, sometimes I just need to see the code to understand.

* It doesn't commit code. I do.

This has been really effective for me, easily 10X'd or more my pace of development. Sometimes I have to ask for a lot of rework and sometimes it one-shots it. But I never ship something I don't understand and it always feels like "my" code. Very satisfying. More satisfying than typing it all out; the typing was never the fun part of programming.

I've found that current models will almost automatically sketch out some things in Python (or another suitable language for the type of task, or an implementation language you've already stipulated) while proposing a design, and you can go through a conversation of "what if we did xyz instead?" and at some point "okay, let's try writing a full prototype" (perhaps tacking on a bunch of decisions here so that things are resolved enough to work with).

But that's at the scale of <1kloc. Might be different if you're trying to do a bigger feature all at once.

I suspect that's a problem both with human read/written code, and LLM written code -- larger features should be chunked up into more manageable to understand and reason about functions, and assembled at higher levels.

Guiding the LLM (or humans structuring/guiding juniors) to shape the abstractions help make the overall feature and reliability of the code much better.

There's something to your approach.

The best results for me have been when I write something 100% in a language and when it is done the AI takes my implementation and ports it to another language.