Live data from Hacker News

AI is forcing us to write good code

bits.logic.inc

201–210 of 229 posts

Re: AI is forcing us to write good code

#201
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…

It’s true - but there are “good code” solutions to this already. For example, BDD / Acceptance Tests can be used to write human-readable specs.

IMO it’s quite boilerplate-y to set this up pre-LLM but probably the ROI is favorable now.

Furthermore, as Uncle Bob has written a lot about, putting effort into structuring your tests well is another area that’s usually under-invested. LLMs often write very repetitive tests, but are happy to DRY out, write factories, etc if you ask them.

Re: AI is forcing us to write good code

#202
I think organization technical leadership wants to deploy AI to ship faster, not so engineering teams can do what they should have been doing all along. "Sure, we can deploy these tools, but first we need to properly document our design" isn't going to fly. The point of buying these tools is so teams ship without really understanding what they're doing, because there's a time cost to that.

Re: AI is forcing us to write good code

#203
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…

In theory, that is the benefit of having an agent that is limited to only doing the tests, and an agent that only does the coding, and have them run separately, that way to fix a test, you don't change the test, etc...

Re: AI is forcing us to write good code

#204

Earlier quoted context omitted.

> Self-teaching pretty much doesn't work. For many decades now, the barrier has not been access to information, it's been the "self" part. That’s a complete bogus. And LLMs are yes men by default, nothing stops you from overriding initial setting.

It's not bogus at all. We've had access to 100,000x more information than we know what to do with for a while now. Right now, you can go online and learn disciplines you've never even heard of before. So why arent you a master of, I don't know, reupholstery? Because the barrier isn't information, it's you. You're the bottle neck, we all are, because we're humans. And AI really just does not help here. It's the same p…

I think LLMs lower the barrier for learning certain topics. For instance, without them I wouldn't have tried to learn about RLC circuits at all.

Re: AI is forcing us to write good code

#205
I feel more like is forcing to write better engineering not just the code.

The disruption comes from the economics of cognitive labor, the synthetic assistants are making feasible things that before were unbearably cognitively costly so manually we invested all that energy into the code parts.

I've made this to leverage that:

https://github.com/sebastianconcept/ai-squads

Re: AI is forcing us to write good code

#206

yeah beekeeping, I think about it alot, I mean the agentic should be isolated on their own environment, its dangerous to give then ur whole pc who nows they silently putting some rootkit or backdoor to ur pc, like appending allowed ssh keys

In Cursor you have Sandbox mode to deal with that issue?

Re: AI is forcing us to write good code

#207

Earlier quoted context omitted.

> which is crazy, given how many resources it's sucking Gentleman, the dog writes poetry and music, but it is boring, mediocre quality. Overhyped dog.

That is a great description of current AI, actually. Love it. Some people are amazed the dog can write poetry. Some people complain that the poetry isn't good enough.

Of what use is a dog that writes bad poetry? It's gone from being a dog to being an annoying dog.

It's like having the power to turn water into gross, undrinkable wine.

Re: AI is forcing us to write good code

#208
post #191

Earlier quoted context omitted.

The first sentence is problematic: > For decades, we’ve all known what “good code” looks like. When relatively trivial concerns such as the ideal length of methods haven't achieved consensus, I doubt there can be any broadly accepted standard for software quality. There are plenty of metrics such as test coverage, but anyone with experience could tell you how easy it is to game those and that enforcing arbitrary stan…

> 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.

Re: AI is forcing us to write good code

#209
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…

Also true of human-written unit tests. You probably also want to have integration or UI automation tests that cover the end-user scenarios in your product requirements, and invariants that are checked against large numbers of examples either taken from production (sanitized of course), in a shadow environment, or generated if you absolutely must.

Re: AI is forcing us to write good code

#210
post #100

Earlier quoted context omitted.

> Imagine building a house from scratch Thats why those Engineering fields have strict rules, often require formal education and someone can even end up in prison if screws up badly enough. Software is so much easier and safer, till very recently anonymous engineering was the norm and people are very annoyed with Apple pushing for signing off the resulting product. Highly paid software engineers across the board must…

> people are very annoyed with Apple pushing for signing off the resulting product. Apple is very much welcome to push for signing off of software that appears on their own store. That is nothing new. What people are annoyed about is Apple insisting that you can only use their store, a restriction that has nothing to do with safety or quality and everything to do with the stupendous amounts of money they make from it…

> Apple is very much welcome to push for signing off of software that appears on their own store.

Just to be clear, apps have to be notarized/signed to run on an Apple device. For macOS, notorized apps aren't required to be distributed in the App Store. Due to sandbox restrictions, some dev tools are distributed independently.

Or there are two versions: a less capable version for the App Store and a more capable version distributed independently.

Post reply on HN