38
u/darkenheit 5h ago
I always wonder why they do that. Just google a library, and don't write thousands line of code.
59
u/Crazy_System8248 5h ago
There was a period of time where it was a real problem that AI models would hallucinate fake libraries existing. It got so bad, hackers went and created the 'fake' libraries and put malicious code inside the calls. Someone coined a term for it: 'slop squatting'
14
2
u/Soilblood 37m ago
Ooh neat. I'mma go slip a few prompts pointing to those in my site. This can only lead to hilarity for them agents and their blind masters.
15
1
1
0
u/leoklaus 1h ago
Maybe I’m just stubborn, but I much prefer to own as much of my code as possible. Most of the time, the feature you actually need is a few hundred lines at most. I actually much prefer this approach over importing random packages.
Also keeps the risk of supply chain attacks lower.
31
u/Ok-PowerCricket 6h ago
the real skill is knowing which 90% of the generated code you can delete without breaking anything XD
5
7
u/KrystianoXPL 4h ago
I had a project rewritten in a different language and framework for the same purpose.
The generated code was extremely verbose, to the point of being 4x of what I wrote. I tried to fix one bug, and I had to change like 3 flags in different places to even go slightly "off the script", just cause the AI chose a specific weird approach.
It wasn't ported by me, so I did not have much control of the process. But it almost feels like its made like that, so it's harder for someone to maintain a code base without a subscription to an LLM like Claude.
1
u/Suitable-Name 1h ago
That's the issue... don't go "translate this"... really go component by component if you want to have control over what the result will look like.
13
u/mylsotol 5h ago
Why have code that meets your exact needs when you could import 8gb of npm modules and hope that none of them are going to install malware on every single machine the project touches
7
u/Mechakoopa 4h ago
Why use a reliable modern OAuth library with for the low cost of a few million tokens you can have your own untested pseudo-JWT signing algorithm that's never heard of an RFC in it's life?
6
u/YeetCompleet 3h ago
The hard part with software engineering is that there's always some arbitrary line in the sand with these decisions. Things that require human deliberation to know if it's better to just code it yourself or to reach for a library. Both the
isEvens andoauths are far away from that line.-1
u/mylsotol 3h ago
I don't think ai is dumb enough to try to reimplement oauth unless the user is dumb enough to explicitly ask for that. If your vibe coded app reimplements oauth you should be banned from using conpuers for life
8
u/TheVibrantYonder 3h ago
> ...unless the user is dumb enough to explicitly ask for that
I have some news for you that may be hard to hear.
2
u/mylsotol 3h ago
Then the problem has nothing to do with ai and as i said the person who made that choice should be banned from using computers for life
1
u/AntipodesIntel 4h ago
Yeah, no longer getting constantly stuck with unmaintained libraries that quickly go out of date and become a liability is actually a god send. Plus you can just ask the LLM to copy the part of the library you need.
I've always said the major problem with open source and github is libraries having their maintainers move on and suddenly you have a dead library that you spent months building your project around.
3
u/kookyabird 4h ago
If the library continues to be maintained, then your LLM copied portions of it aren't going to be as easily updated to address bugs or security concerns.
If it isn't maintained, then you've still built your project around a section of now abandoned code that the LLM isn't going to be able to pull anything new from.
If you built a good project, then a library being abandoned shouldn't be catastrophic. It's not like the package is going to go away, and unless you're in the middle of moving to a new version of your standard library that the abandoned one is incompatible with you should have time to find and implement a replacement. Or make your own, if you've come to the realization that you only needed a small portion of the functionality it offered.
9
u/sadongrohiik 4h ago
"Write a simple unit test for this function" +2800 codes added. My man is testing a webhook dispatcher on the off chance than it might be used to send messages to aliens
4
1
1
u/Tucancancan 4h ago
Better add checks, fallbacks and inlined magic-numbers to that line fetching a parameter from the config that is packaged with the app, without which the entire thing wouldn't start up!
1
u/Aggravating-Owl-5220 1h ago
The real horror isn't reading someone else's code. It's reading code YOU generated with AI yesterday and having absolutely no memory of why any of it works.
1
1
u/stillalone 5h ago
I honestly feel like this is regular coding as well.
People try to take into consideration edge cases that never happen and end up missing the edge cases that do. Also the environment changes where edge cases that were relevant no longer becoming relevant (though this might be a microservices thing where bugs in other services get fixed and you're not 100% sure it's fixed all the time so you end up leaving your workaround indefinitely).
1
0
0
-1
92
u/kushalgarg592 6h ago
Asked for one function recieved a small startup