Live data from Hacker News

AI is forcing us to write good code

bits.logic.inc

211–220 of 229 posts

Re: AI is forcing us to write good code

#211
post #160
post #134

There's a catch with 100% coverage. If the agent writes both the code and the tests, we risk falling into a tautology trap. The agent can write flawed logic and a test that verifies that flawed logic (which will pass). 100% coverage only makes sense if tests are written before the code or rigorously verified by a human. Otherwise, we're just creating an illusion of reliability by covering hallucinations with tests. A…

All the problems you list are true, but the solutions not so much. I've seen this problem with humans even back at university when it was the lecturer's own example attempting to illustrate the value of formal methods and verification. I would say the solution is neither "get humans to do it" nor "do it before writing code", but rather "get multiple different minds involved to check each other's blind spots, and no m…

Maybe this is because humans have good intuition to know the difference between us. But this type of intuition does not work on the behaviour of LLMs.

Re: AI is forcing us to write good code

#212

Earlier quoted context omitted.

> This is sort of why I think software development might be the only real application of LLMs outside of entertainment. Wow. What about also, I don't know, self-teaching*? In general, you have to be very arrogant to say that you've experienced all the "real" applications. * - For instance, today and yesterday, I've been using LLMs to teach myself about RLC circuits and "inerters".

I would absolutely not trust an LLM to teach me anything alone. I've had it introduce ideas I hadn't heard about which I looked up from actual sources to confirm it was a valid solution. Daily usage has shown it will happily lead you down the wrong path and usually the only way to know that it is the wrong path, is if you already knew what the solution should be. LLMs MAY be a version of office hours or asking the TA…

> LLMs MAY be a version of office hours or asking the TA

In my experience, most TA's are not great at explaining things to students. They were often the best student in their class, and they can't relate to students who don't grasp things as easily as they do--"this organic chemistry problem set is so easy; I don't know why you're not getting it."

But an LLM has infinite patience and can explain concepts in a variety of ways, in different languages and at different levels. Bilingual students that speak English just fine, but they often think and reason in their native language in their mind. Not a problem for an LLM.

A teacher in an urban school system with 30 students, 20 of which need customized lesson plans due to neurological divergence can use LLMs to create these lesson plans.

Sometimes you need things explained to you like you're five years old and sometimes you need things explained to you as an expert.

On deeper topics, LLMs give their references, so a student can and should confirm what the LLM is telling them.

Re: AI is forcing us to write good code

#213

The expertise in software engineering typical in these promptfondling companies shine through this blog post. Surely they know 100% code coverage is not a magical bullet because the code flow and the behavior can differ depending on the input. Just because you found a few examples which happen to hit every line of code you didn't hit every possible combination. You are living in a fool's paradise which is not a surpr…

So, what is the solution? Senior engineer looks over PR and signs LGTM? That is just "vibe testing". The worst kind of testing. I think the author is right, setting up tests to form a reactive environment for coding agents will lead us to a new golden age. If you later find some issue with your test case coverage, you expand it. But it is good to do it from the start as throroughtly as possible.

> So, what is the solution?

1. Clearly explain the massive harm LLMs cause society and the environment to everyone. (Mass media should do this instead of parroting every nonsense the promptfondlers feed them.)

2. Ban them all. Don't tell me it's impossible just because it's widespread. Asbesthos was everywhere.

Re: AI is forcing us to write good code

#214

Earlier quoted context omitted.

That’s why you’ve gotta test your tests. Insert bugs and ensure they fail. As the sibling comments alluded to, it’s not exclusively an AI problem since multiple people can miss the issue too. It’s wonderful that AI is an impetus for so many people to finally learn proper engineering principles though!

but who will test the tests of tests?

[deleted]

Re: AI is forcing us to write good code

#215
post #44

This is sort of why I think software development might be the only real application of LLMs outside of entertainment. We can build ourselves tight little feedback loops that other domains can't. I somewhat frequently agree on a plan with an LLM and a few minutes or hours later find out it doesn't work and then the LLM is like "that's why we shouldn't have done it like that!". Imagine building a house from scratch and…

Thinking about this some more, maybe I wasn't considering simulators (aka digital twins), which are supposed to be able to create fairly reliable feedback loops without building things in reality. Eg will this plane design be able to take off? Still, I feel fortunate I only have to write unit tests to get a bit of contact with reality.

Simulations in general are pretty flawed, and AIs will usually find ways to "cheat" the simulation.

It's a very useful tool of course, but not as good as the software situation.

Re: AI is forcing us to write good code

#216
So many of us see an LLM spit out a bunch of code in a at a very high rate and we're amazed. It is really impressive, but what we're forgetting is that the amount of code and the speed at which code is written has never been the bottleneck in developing good quality software.

AI will revolutionize software development if and when it does a far better job of producing correct code than humans.

Re: AI is forcing us to write good code

#217
post #191

Earlier quoted context omitted.

> When relatively trivial concerns such as the ideal length of methods haven't achieved consensus Is the consensus not that there isn't one? Surely that's the only consensus to reach? I don't see how there could possibly be an "ideal length", whatever you pick it'd be much too dogmatic.

John Carmack's and Martin Fowler's coding style advice are diametrically opposed. Carmack advocates inlining complex code that is only used once. Fowler advocates extracting it with a good name to clarify intent. I'm not sure the two views can be reconciled except by noting that they address separate concerns. Carmack prioritizes visibility while Fowler prioritizes intent.

With all due respect to these who as programmers are on a whole different dimension than me.. this seems like a case where both either their words were taken out of context, or one of the millions of cases of brilliant people hyperfixating on their particular domain and mistakenly extrapolating that to everywhere. Their advice could well be right for the particular type of code each of them worked on!

But taking them as general rules for coding makes as much sense as applying advice for painting a bridge to painting the Mona Lisa. Seriously, try to come up with a single piece of advice about programming style that applies to every domain. The closest one I can think of is "give descriptive name to your variables", and even that doesn't apply to lots of code written to this very day. It's impossible.

Software in 2025 is far too varied for any of that to make sense, and it has been for many decades.

Re: AI is forcing us to write good code

#218
post #216

So many of us see an LLM spit out a bunch of code in a at a very high rate and we're amazed. It is really impressive, but what we're forgetting is that the amount of code and the speed at which code is written has never been the bottleneck in developing good quality software. AI will revolutionize software development if and when it does a far better job of producing correct code than humans.

My biggest problem with usage of an LLM in coding is that it removes engineers from understanding the true implementation of a system.

Over the years, I learned that a lot of one's value as an engineer can come from knowing how things actually work. I've been in many meetings with very senior engineers postulating how something works arguing back and forth, when quietly one engineer taps away on their laptop, then spins it around to say "no, this is the code here, this is how it actually works".

Re: AI is forcing us to write good code

#219
What if 'good code' is just 'code optimized for humans who can't hold much in working memory'? The model doesn't need breadcrumbs if it can see everything at once. If context windows 100x, think some of this may be less relevant. Big IF, have no idea tbh, hard to predict.

Re: AI is forcing us to write good code

#220

Earlier quoted context omitted.

Because you can independently check anything it tells you. You understand there can be independent sources of validation?

Why not just search out the independent sources and ditch the middleman?

Because verifying something is easier than finding it in the first place. It's in some way the difference between P and NP.
Post reply on HN