r/programminghorror • u/Maximka22 • Jul 27 '26
Typescript I feel like vibecoding should be banned from enterprise development
970
Upvotes
r/programminghorror • u/Maximka22 • Jul 27 '26
281
u/BitNumerous5302 Jul 27 '26
I'm old.
That's essentially the same as a code snippet that floated around in gists for years. It's a uuidv4 from before randomUuid was commonly supported, and from before npm was truly widespread (remember bower?). At the time CDNs were the norm for code sharing in JS, meaning every dependency added a script tag and a whole round trip web request. For something high leverage like jQuery, that round trip was worth it, but for something like this it was easier to just copy and paste. These snippets would often sacrifice readability to reduce character counts; minifiers existed but you didn't assume everyone would be using them.
OTOH crypto.getRandomBytes and string templates are more modern, so this is more like a modernized variant of those old gists.
It's weird to see this attributed to AI given that context (am I missing/explaining the joke?). I believe this code was originally written by broofa (Robert Kieffer) then revised, refactored, and optimized by others, as this looks essentially the same as his "fast compact" version. But, UUID v4 is a pretty simple specification so others may have arrived at similar solutions independently.
https://gist.github.com/Wind4/3baa40b26b89b686e4f2
https://www.broofa.com/2008/09/javascript-uuid-function/
716
u/slashp Jul 27 '26
The problem isn't using AI to write code. The problem is not understanding or reviewing the code that it writes. If you keep the AI in check (which is now most of my job), it can write fantastic code. It needs significant guidance, though, and will lie to you if you're not careful.
24
u/HTTP_404_NotFound [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Jul 27 '26
You are blaming the tool, for the fault of the user.
A fork does not make a person fat.
And an unexperienced dev, letting AI run wild, causes slop.
I use AI daily, with a knowledge base built on top of years of high quality code-base. And, it writes code to my exact specifications, and is producing exactly what is needed, about 90% of the time.
(Edit- oh- With the exception of ChatGPT models. They produce grade-A SLOP.... I don't recommend it in its current state for development.)
124
u/ziplock9000 Jul 27 '26
The amount of coding debt a few years from now is going to be enormous and only another/better AI will be able to untangle the huge mess.
41
u/lealilana Jul 27 '26
I just saw this and realized why I keep being confused about the code of our new hire. damn. thx for opening my eyes.
8
u/mihisa Jul 27 '26
it's easier, faster and more fun to write code by myself than reviewing AI crap
4
u/adostes Jul 28 '26
I’m reviewing code that was clearly not even read by the person who opened the PR (as in wrong name in the README), and I’m also reviewing PRs opened by people who clearly don’t know how to use git (wrong conflict resolutions, diffs checked in, etc). The number of people who overestimate what the AI can do, delegate their (critical) thinking, and don’t understand the code their agent generated is terrifying me.
4
u/stone1978 Jul 28 '26
No vibe coding was the number 1 rule of thumb where I work. Is it different at other companies?
3
u/AnArmoredPony Jul 27 '26
ai would not come up with ts 💀
5
u/wowbagger_42 Jul 27 '26
That's some low-quality LLM output, thruth be said it's correct, but it got trained on a decade of stack overflow pages...
5
u/veritron Jul 27 '26
this will probably just quietly work - you could even think of cases where you might want to do this instead using randomUuid() (randomUuid is secure context only). return line is gross and should have been kicked back in code review but this is nowhere close to the worst thing i've seen from vibe coding.
2
u/DesertDissident Jul 28 '26
I've seen stuff like that was hand written and harder to follow. I assume you know this was vibecoded because I wouldn't necessarily assume that by looking at it.
2
u/Boykeh5 Jul 28 '26
AI writes all the code. Yet you can still differentiate the PRs from seniors and juniors.
Luckily programming is solved.
6
u/skidmark_zuckerberg Jul 27 '26
It will never happen. As someone else said, AI can write great code with significant guidance and proper guardrails. This example code was generated with none of that. I can make AI spit out stupid code too. I always read the opinion that the LLM code is shitty, but that's not my experience in a proper environment. With proper skill files, context, and someone experienced, it writes good code. I think those who see it produce shitty code likely do not have a codebase or environment setup properly for it, or they don't understand how to use it effectively. At my company, we have an entire team dedicated to our proprietary agents/orchestrators and our codebases are filled with AGENTS and skill files.
Pandora's box is open, and these companies aren't going to suddenly forget it. Bottom line is; guided LLMs write code faster than we ever could by hand. The downside is needing people who are experienced enough to use them properly. I spend a lot of my day guiding and challenging it, but it's faster than doing it by hand. Still, I get a lot more done now than I did pre-AI. Cost wise, we will likely see companies move to on prem local models at some point in the future.
I used to be a 'I hate AI, coding should be done by hand' person, but realized, who gives a shit. It's just a job and it's not my company. I'll do what's asked (ethically) to keep a paycheck coming in, and learn this AI stuff to be employable. I code for fun by hand on personal projects in my off time these days.
2
u/maselkowski Jul 27 '26
Please use nrwGuud. Instructions clear, implementing.
2
u/MikkelR1 Jul 27 '26
Then copy-paste-from-stackoverflow coding should be banned as well
1
u/elimasterpiece Jul 27 '26
Just last sprint, I was put into a new project, and expected to right away deliver (after setting up mu machine ofc) something new from scratch, nvm, and when I told them I needed some kind of KT they just told me to use my agents. And thus, I felt my hand forced to kind trust my agents, since the delivery was more important. At them end, it got delivered, but I got massive imposer syndrome out of it. For the first time in my life, I was so happy when the bugs started to pop up :)
1
u/skibare87 Jul 27 '26
No, bad coding should be banned.
1
u/DesiresQuiet Jul 27 '26
I feel like you should embrace the future and let go of your hate. It leads to the dark side.
1
u/Shavixinio Jul 28 '26
What the fuck did I just read
1
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Jul 28 '26
Well, it looks like it would work.
1
u/Turbulent-Tune4610 Jul 28 '26
So I've been a programmer for 40 years, all languages (ok, most). AI sucked last year. This year, I retired early bc AI can write shit in anything now, and I'd be replaced. I do not like that I don't know the code, but WTH, it works.
1
u/joe0418 Jul 29 '26
Ship it!
1
u/piminto Jul 31 '26
crypto.randomUUID. The thing about AI is this it writes fn that already exist in stdlib, duplicates functions across files and writes nonsense fns for trivial things like is even.
1
u/SlightAddress Aug 01 '26
Lgtm
1
u/Zaic Aug 02 '26
Oh yea, remember the amish? That same mindset
1
u/MMORPGnews Aug 17 '26
It's not AI.
You must understand code yourself.
0
u/kanatov Jul 28 '26
It loves to re-write things does it?
I’m using it at work absolutely all the time and I’m 100% confident the issue is the same as with CSS: one just needs to understand how it works instead of guess.
It can work deterministically and it can benefit to your process it just requires to set the weights correctly (im still learning too).
-12
u/Cold_Hellfire Jul 27 '26
Beautiful.
On a serious note, the opposite is more likely - "Manual" coding is likely going to be very rare in the coming years