Live data from Hacker News

Using AI to write better code more slowly

nolanlawson.com

191–200 of 511 posts

Re: Using AI to write better code more slowly

#191

Earlier quoted context omitted.

Nothing wrong at all. Some features you can bolt on, and some features fundamentally change how a system works requiring changes at many different levels of the stack. Happens all the time.

It happens in poorly factored codebases. If you find it happening that's a sign you need to refactor. If you find it happening repeatedly in the same codebase that means you failed to refactor properly the first time.

Not many industries can afford refactoring of the code is not supposed to be changed - additional (unexpected) regression testing costs, risk of downtime, etc. You learn that if it works and is in production - don't touch it.

Re: Using AI to write better code more slowly

#192
The main insight here I think is that LLMs are great tools for iterative development and iterative problem solving in general.

You can very effectivly iterate alone using the LLM as a mirror, rephrasing what you put in and adding a bit.

You can use LLMs to quickly create prototypes to give to other human beings to help you with the next iteration.

If you get something from someone else to iterate on you can use the LLM to help you with understanding to rephrase things in a way more suitable for your understanding.

But instead everything anybody seems to be talking about seems to be one shoting things and AI iterating with other AI.

The big problem here is that the one thing AI does not have is agency. The naming AI agent is wishful thinking and marketing.

Re: Using AI to write better code more slowly

#193

As I read this, I'm also working through a pretty dense feature that took a fair bit of iteration. The end result is actually significantly less code than it was about halfway through. And I was wondering if the AI actually helped me at all, since surely I could have written the code in the same time it took to iterate But! Because of AI I was able to rapidly hack out like 4 variants of this feature that I didn't lik…

True. I think this is the biggest help with AI. It does not necessarily help with reaching the end goal faster all the time but it helps in trying out different iterations for quick prototypes. I find it especially useful in fast moving startups where some times we just want to validate a few ideas before fleshing them out as proper features.

Re: Using AI to write better code more slowly

#194
post #59

Earlier quoted context omitted.

Talking the problem to death with the AI before implementation is a nice zone for me. I feel productive, get good results out of the AI, and still largely understand the code. That’s the part of the AI revolution that I feel has made me a better engineer because I argue about design and architecture all day with a robot.

I follow the same process. I have a design in mind for the problem at hand, but I don't reveal it to Codex. I go back and forth a bit to see if its proposals are better than mine. I go back and forth on tradeoffs of various approaches. And then I ask it to compare its proposals with mine. I "win" most of the time but there are many times where it shows a me a better, or simpler approach, or makes me rethink the solut…

> I go back and forth a bit to see if its proposals are better than mine

I find it useful to let it generate benchmarks comparing the approaches. Turns out AI is terrible at guessing whats faster or allocates less

Re: Using AI to write better code more slowly

#195
Yes! That's what I've been doing at work for the last few weeks! And while it doesn't appear to be super fast, I'm already pretty certain that the next round of testing will come back with fewer unexpected issues because together with my agent and the right usage, I was already able to catch stuff that I would have missed otherwise.

Also feels much better than pure vibe-coding (which I still do for personal projects that aren't mission critical for anyone).

Re: Using AI to write better code more slowly

#196
post #38

I find myself spending on average more time in LLM review/resolution loops than it would take for me to write the code by hand. Partially because once I'm in the flow I write very very quickly and the code pours out sometimes faster than I can write. But also because the LLM code on the first few tries is generally really really bad. What I find interesting though is that spending the time to personally review and di…

If your AI is writing bad code then you need to change your AI. No current high-end AI should be producing bad code.

It's most likely they can't prompt properly.

Re: Using AI to write better code more slowly

#197

Earlier quoted context omitted.

You're not on v3 lol. You're on v1 that you had to redo three times. If the feature isn't released, it's not a new version.

Semantics. In reality yes it is the v3 version equivelent in terms of maturity and iteration. I know because I've been doing this for a long time. We are getting to v3 and beyond faster than ever before. In the new world there is no time to put out v1 quality code and it is borderline reckless given how easily things are getting hacked now. You need to be putting out heavily reviewed code that covers all the corner c…

No, you're getting to v1 in the same or more amount of time. I know v3 sounds better, but coding and throwing it away is literally just redoing it. If you're not releasing it, it's not a new version.

There's no such thing as "v1 quality code", you just haven't finished it yet.

Re: Using AI to write better code more slowly

#198

Earlier quoted context omitted.

And then Anthropic has an outage and you what...have a coffee break until then? All that time babysitting the AIs just to be a little faster but probably with less knowledge/control over what they did?

And then solar radiation permanently knocks out the electrical grid and you what... have coffee break until society finds a new equilibrium?

No, then you go back to programming on the white board, just like in college. /j

Re: Using AI to write better code more slowly

#199

Earlier quoted context omitted.

At this point one might as well code by themselves

Unfortunately the projects are still too big. Projects with hundreds of thousands to millions of lines of code can't be maintained by a single person reviewing all the the changes. And AI only increases the speed of iteration and the amount of code to review. We may need some sort of paradigm shift - like more powerful frameworks or even higher level languages that allow us to review less, but more functional code bl…

When AI tries to improve such large code base who even is going to review the changes?
Post reply on HN