Live data from Hacker News

Write code like a human will maintain it

unstack.io

111–120 of 325 posts

Re: Write code like a human will maintain it

#111
post #55

Earlier quoted context omitted.

He just means the development pace has picked up with AI. I've been doing this for 15 years, I love coding manually. However, with AI-assistance I can do projects in 3 days what would take 6 months. It's not vibe coding, everything is controlled, reviewed, understood, refined by me in the end. But still the dev time is magnitudes faster. I would not hire anyone that is adverse to AI. I'm actually happier. With age an…

> I can do projects in 3 days what would take 6 months. The hyperbole on this keeps growing every time I see it. Soon we’ll be having people claiming they can do in 12 seconds what used to take them 17 years. What is never presented is proof. People (and programmers are no exception) are notoriously bad at estimating. We already did studies where people thought they were being faster with LLMs when they were in fact…

It's not a hyperbole. I know how long it takes me to do something.

And the last project truly would have taken me 6 months.

It was done in 3 days after fable 1:1 the design, setup the infrastructure, and turned all tasks and specs into code.

Everything was done day 1, but it took 2 days to manually clean it, test, and correct small issues.

--

But that does make sense you're seeing "hyperboles" grow, AI is getting better very quickly, so you'll see the time saved estimations grow.

Less than a year ago I'd say it was saving me about a month of work, mainly because it sucked at UI.

Re: Write code like a human will maintain it

#113
post #94

Counterpoint: This no longer matters because we are not going back to hand-writing these functions. These patterns were designed to make code easier for humans to read and write, but that is no longer the primary way software is built.

Counterpoint: as long as context don't rot or it's less effective that starts maintaining repetitions only slightly different. Also > we are not going back to hand-writing these functions do you really think there isn't a good chunk, if not the majority outside some bubbles, of developers that still hand code? Crazy to hear, I bet you're not a programmer

The change is exponential and happening daily. The future is smaller teams spending a lot of money on AI credits.

Re: Write code like a human will maintain it

#114
What happens when shit hits the fan in my exp is that I have to crack open the codebase and debug some portion of it, so I can explain it to myself in order to be able to explain what is wrong to the LLM.

Otherwise what I have found is that the LLM will add a new if statement which will handle the newly discovered issue and you start stacking them ifs. As the article mentions LLM's unlike humans aren't lazy, they will copy, paste add patches for every issue, why bother think and understand root cause :d.

So as part of our review we have a rule against that as well.

Re: Write code like a human will maintain it

#115
post #64

I have good results with this prompt after every larger change: Now do a final code check. Is everything tidy and do the components adhere to the principle of separations-of-concerns. Is everything in an understandable and maintainable state? Do we make any assumptions that may not be true anymore? Is any code left over from previous edits or experiments that does not belong into the codebase? Is the documentation st…

good, but this is just a verbose "make no mistakes"; it'd probably make more sense to just setup a nightly cron job that loops through the prior days' work and writes some morning tasks of the same character. The models will interpret this willynilly; but nonetheless, it's often a better than doing nothing.

It means the same thing to you, but not to the whole spectrum of people using AI. You literally see it on Reddit all the time where people are complaining about the same model either over-engineering or doing too much, vs it being requiring too much steering or not being autonomous or capable enough to hand off tasks to on its own.

The reason prompting it to review its own work for loose ends, record any new undocumented or noteworthy behavior, suggest changes to tests/processes to make it go more smoothly the next time, etc is that it’s prescriptive and process-oriented (and thus easily verifiable/done in-context) rather than descriptive and outcome oriented (which to do properly could require way more context than the model has, because it doesn’t know what it doesn’t know about your particular work, only what it’s seen so far).

Even promoting it to do these after-the-fact vs as an upfront requirement can have a big impact IMO. If you make “maintainability” part of the task before it’s seen the real work it will focus on general “best practices” crap rather than the real work, so either way if this is something you care about it doing you have to give it guidance for how you want it done.

If you were to review the logs of a model after the fact, you’d also not really save on input tokens unless you compressed the context or sharded it out, which can easily miss the small details that constitute the difference between “what actually happened” vs “how the LLM models this general class of problems” unless the first pass involves the entire context anyway. That said I do think there’s a lot of value in building some kind of pipeline for validating and aggregating these “learnings” across sessions.

Re: Write code like a human will maintain it

#116
post #69

Earlier quoted context omitted.

AI is trained on a various range of code quality, including very low one. I'm paid to provide good quality code and not flood my company with more average code than it should. In my previous job, I could regularly reduce a PR code down to 10-20%% of its size because someone overlooked something or was just "overengineer" a feature. AI are such "bullshiters" that they produce more text than necessary. Code bloat was a…

blah blah blah YOU ARE GOING TO BE REPLACED

Yes. But definitely not this year.

Re: Write code like a human will maintain it

#117
post #114

What happens when shit hits the fan in my exp is that I have to crack open the codebase and debug some portion of it, so I can explain it to myself in order to be able to explain what is wrong to the LLM. Otherwise what I have found is that the LLM will add a new if statement which will handle the newly discovered issue and you start stacking them ifs. As the article mentions LLM's unlike humans aren't lazy, they wil…

Humans will do this as well, especially inexperienced junior SWEs. Adding a new boolean parameter and some if statements here and there. After a while a seemingly simple function takes four boolean parameters that each control a little bit of what the function does.

The benefit is that a human who is a junior might need at least a few weeks to months of guidance to have a good taste of when to duplicate and when to DRY. An LLM likely already has good judgment, and your prompt merely needs to be activate this judgment.

Re: Write code like a human will maintain it

#118
post #94

Counterpoint: This no longer matters because we are not going back to hand-writing these functions. These patterns were designed to make code easier for humans to read and write, but that is no longer the primary way software is built.

Code structure still matters for cost effectiveness and performance over time

https://arxiv.org/abs/2605.20049 https://arxiv.org/abs/2605.13280

Re: Write code like a human will maintain it

#119

Earlier quoted context omitted.

Counterpoint: as long as context don't rot or it's less effective that starts maintaining repetitions only slightly different. Also > we are not going back to hand-writing these functions do you really think there isn't a good chunk, if not the majority outside some bubbles, of developers that still hand code? Crazy to hear, I bet you're not a programmer

The change is exponential and happening daily. The future is smaller teams spending a lot of money on AI credits.

If it really is exponential intelligence should have already exploded. Go give away your certainties on a seer's forum

Re: Write code like a human will maintain it

#120
post #46

The key idea here is that your codebase is context that will be used for future changes. And context determines the model’s output, so it’s still worth having a well-designed codebase. Easier said than done to be honest, especially if there are many people (and their agents) pushing code. It’s hard to keep up these days.

I’m not so sure this matters. My team manages a couple pretty new projects and I still see LLM tools doing this. I’m starting to suspect that vendors are building in these behaviors to ensure the output compiles (never throw an exception, null check every variable no matter what, never change a function or method but copy or inline its code and change that, etc.)

I think I would prefer code that is clear, understandable and simple even if it doesn’t compile and needs some straightforward polishing.

Post reply on HN