←back to thread

-2000 Lines of code

(www.folklore.org)
502 points xeonmc | 6 comments | | HN request time: 1.303s | source | bottom
Show context
daitangio ◴[] No.44381563[source]
Software metric are hard, indeed :) Be prepared in a ai-code world when more code does not mean better code.
replies(2): >>44381664 #>>44381673 #
bunderbunder ◴[] No.44381664[source]
I've been watching my colleagues' adoption of Copilot with interest. From what I can tell, the people who are the most convinced that it improves their productivity have an understanding of developer productivity that is very much in line with that of the managers in this story.

Recently I refactored about 8,000 lines of vibe-coded bloat down into about 40 lines that ran ten times as fast, required 1/20 as much memory, and eliminated both the defect I was tasked with resolving and several others that I found along the way. (Tangentially, LLM-generated unit tests never cease to amaze me.) The PHBs didn't particularly appreciate my efforts, either. We've got a very expensive Copilot Enterprise license to continue justifying.

replies(6): >>44381723 #>>44381759 #>>44381879 #>>44382024 #>>44382066 #>>44382304 #
1. 2muchcoffeeman ◴[] No.44382066[source]
I don’t believe your numbers unless your colleagues are exceptionally bad programmers.

I’m using AI a lot too. I don’t accept all the changes if they look bad. I also keep things concise. I’ve never seen it generate something so bad I could delete 99 percent of it.

replies(3): >>44382148 #>>44382164 #>>44388864 #
2. WD-42 ◴[] No.44382148[source]
90%+ is a stretch. Anecdotally I have cleaned up a vibe coded PR and removed at least half of the code. The thing with the LLM is that often they will make some decision up front that has downstream ramifications for how the entire project's code is structured. I don't think I've seen an LLM re-visit it's assumptions, instead they code around them.

In the case I saw, it was rust code and the LLM typed some argument as a Arc<Mutex<_>> when it absolutely did not need to, which caused the entire PR to inflate. The vibe coder apparently didn't catch this and just kept it vibing... Technically the code did what it needed to do but was super inefficient.

It would have been easy for me to just accept the PR. It technically worked. But it was garbage.

replies(1): >>44382507 #
3. akavi ◴[] No.44382164[source]
I've never seen 8000 -> 40, but I have done ~10 kLoC -> ~600.

Aggggressively "You can write Java in any language" style JavaScript (`Factory`, `Strategy`, etc) plus a whole mini state machine framework that was replaceable with judicious use of iterators.

(This was at Google, and I suspected it was a promo project gone metastatic.)

4. 2muchcoffeeman ◴[] No.44382507[source]
Yes. This is why I’m still “designing” projects and asking fairly specific things most of the time.

But it’s pretty obvious when it produces garbage. So you’d reject it there and then. At the very least code review will raise so many questions. How did 8000 lines make it into the code base?

replies(1): >>44382681 #
5. WD-42 ◴[] No.44382681{3}[source]
I think you are over-estimating how much people care. If the code runs and provides the desired result, there are many, many people who will simply ship it. This is the bed we made for ourselves.
6. bunderbunder ◴[] No.44388864[source]
The original used a Shlemiel the painter algorithm, a whole bunch of "enterprise" coding patterns, and its own implementations of a bunch of things we already had. Including domain objects, which meant that a whole bunch of excess glue code was needed to interface with the rest of the system.