Most active commenters
  • bunderbunder(3)
  • api(3)

←back to thread

-2000 Lines of code (2004)

(www.folklore.org)
510 points xeonmc | 28 comments | | HN request time: 0.837s | source | bottom
1. 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 #
2. 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 #
3. uaas ◴[] No.44381673[source]
This is also true for human code, more often than not.
4. api ◴[] No.44381723[source]
I see a stratified software market in the future.

There will be vibe and amateur banged out hustle trash, which will be the cheap plastic cutlery of the software world.

There will be lovingly hand crafted by experts code (possibly using some AI but in the hands of someone who knows their shit) that will be like the fine stuff and will cost many times more.

A lot of stuff will get prototyped as crap and then if it gets traction reimplemented with quality.

replies(5): >>44381777 #>>44381779 #>>44381787 #>>44381860 #>>44382210 #
5. switchbak ◴[] No.44381759[source]
"8,000 lines of vibe-coded bloat down into about 40 lines" ... I just saw a vision of my future and shuddered.

I mean, I like killing crappy code as much as the next guy, but I don't want that to be my daily existence. Ugggh.

6. librasteve ◴[] No.44381777{3}[source]
yeah this is it ...
7. doesnt_know ◴[] No.44381779{3}[source]
This was said about large frameworks like electron on the desktop, but outside of some specific technical niches it literally doesn’t matter to end users.
replies(1): >>44381987 #
8. Miraste ◴[] No.44381787{3}[source]
Where's the part where it's different from the existing market?
replies(1): >>44382872 #
9. bitwize ◴[] No.44381860{3}[source]
Back in the day, if you went to a website you could always tell who wrote their HTML by hand and who used a tool like GruntPage, Dreamweaver, etc. even without looking at the META tags. The by-hand stuff was like a polished jewel that had only as much layout, styling, and markup as needed to get the desired effect. The proprietary web editor stuff was encrusted with extraneous tags and vendor-specific extensions (like mso: attributes and styles in GruntPage).

Then as now, if you let the machine do the thinking for you, the result was a steaming mess. Up to you if that was accessible (and for many, it was).

replies(1): >>44381921 #
10. 0cf8612b2e1e ◴[] No.44381879[source]
I would love to know the time balance between the two activities. It takes nothing to generate slop, but could be weeks to extricate it.
11. wffurr ◴[] No.44381921{4}[source]
You can make the same claim about compiled code vs hand written assembly, and yet the vast majority of software is compiled or interpreted.
replies(2): >>44381981 #>>44381994 #
12. DowsingSpoon ◴[] No.44381981{5}[source]
In the past, hand-crafted assembly code was common because it was easy to beat the compiler. This is still true today in some niches.
13. kbelder ◴[] No.44381987{4}[source]
It does matter and they do care; they just don't have the specific technical knowledge to pinpoint why their computer sucks now.
replies(1): >>44384909 #
14. dgfitz ◴[] No.44381994{5}[source]
A compiler is written by very smart humans to a spec written by humans, also probably smart but I don’t know enough to claim that bit.

An LLM is just displaying the next statistical token.

Completely different.

replies(1): >>44382038 #
15. Izikiel43 ◴[] No.44382024[source]
> Tangentially, LLM-generated unit tests never cease to amaze me.

In a good or bad way?

I've found AI pretty helpful to write tests, specially if you already have an existing one as a template.

replies(1): >>44388908 #
16. bitwize ◴[] No.44382038{6}[source]
Or, as I like to put it, pulling out the next refrigerator poetry tile from a stochastic bag of holding.
17. 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 #
18. WD-42 ◴[] No.44382148{3}[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 #
19. akavi ◴[] No.44382164{3}[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.)

20. robocat ◴[] No.44382210{3}[source]
A beautiful vision.

If the vision were true, we should see it happen with normal goods too. Quality physical goods do not beat the shit goods in the market : crap furniture is the canonical example (with blog articles discussing the issue).

Software (and movies) is free for subsequent copies, so at first sight you might think software is completely different from physical goods.

However for most factory produced goods, designing and building the factory is the major cost. The marginal cost of producing each copy of an item might be reasonably low (highly dependent on raw materials and labor costs?).

Many expensive physical goods are dominated by the initial design costs, so an expensive Maserati might be complete shit (bought for image status or Veblen reasons, not because it is high quality). There's a reason why the best products are often midrange. The per unit 2..n reproduction cost of cheap physical goods is always low almost by definition.

Some parts of iPhone software are high quality (e.g. the security is astounding). Some parts are bad. Apple monetisation adds non-optional features that have negative value to me: however those features have positive value to Apple.

replies(1): >>44386142 #
21. amluto ◴[] No.44382304[source]
Every now and then, in between reasonable and almost-reasonable suggestions, Copilot will suggest a pile of code, stylistically consistent with the function I’m editing, the extends clear off the bottom of the page. I haven’t been inspired to hit tab a couple times and try to reverse engineer the resulting vomit of code, but I can easily imagine a new programmer accepting the code because AI! or, perhaps worse, hitting tab without even noticing.
22. 2muchcoffeeman ◴[] No.44382507{4}[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 #
23. WD-42 ◴[] No.44382681{5}[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.
24. api ◴[] No.44382872{4}[source]
What I meant was that the contrast will become much more extreme, like the difference between fine silverware and bulk plastic cutlery from Wal-Mart.

Pre-vibe-coding it was more like the difference between fine silverware and cheap stamped metal stuff.

25. whatevertrevor ◴[] No.44384909{5}[source]
And why it takes months to years to fix basic bugs that have been acknowledged by the developer.
26. api ◴[] No.44386142{4}[source]
What happens is the price difference gets huge. Quality furniture does beat shit at the high end of the market, but a real quality bed or sofa costs over a thousand dollars and up from there. The price difference between shit and quality starts at 5-10X.

Tangent but -- one furniture hack I've found is that if you don't want to pay a lot go for the simplest design you can find made of basic wood or metal. It'll be... a wood or metal kit that assembles into the basic form of what is needed. Wood is often unfinished or minimally finished. That stuff is pretty durable. Things that look "fancy" but are cheap tend to be utter trash, made of the worst materials with poor tolerances. A more elaborate or artistic design plus quality equals expensive.

When I say minimal I mean minimal. A cheap quality bed frame is a rack the mattress sits on. A cheap quality dresser is basically bins on tracks.

Ironically places like Amazon is where you find this cheap quality minimal stuff. Furniture stores are complete trash unless they are artisan, often local, like I live in Ohio and there are artisan Amish furniture sellers that sell good (but $$$) stuff that is literally hand made. But find one that is actually sourcing or even tied to an Amish community. You don't have to look into the store, just the stuff inside. It will be solid and build via obvious craft joinery, etc., and will weigh a ton. (and you're supporting a local community)

So I wonder if software will start to look like that. Pay a lot (like enterprise prices) for highly regarded pro software or find something minimal "hand made" by a 1-5 person shop. The world of quality native Mac apps comes to mind for the latter.

27. bunderbunder ◴[] No.44388864{3}[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.
28. bunderbunder ◴[] No.44388908{3}[source]
I guess it depends on how much you like things like well-obfuscated smoke tests and mocks that don't accurately simulate relevant parts of the behavior of the module they're mocking.