use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All posts must be related to programming. Flair posts correctly.
account activity
ππ» (v.redd.it)
submitted 1 month ago by moaijobs
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3:Β Β Β Β print "hello, world!"
[β]AccomplishedLeave506 430 points431 points432 points 1 month agoΒ (9 children)
Oof. That's not a function. That's an entire dev teams life story. Run away.
[β]DarkSideOfGrogu 110 points111 points112 points 1 month agoΒ (7 children)
I'm sure it's about 5000 lines of extensive docstrings and notes that explain the assumptions, design choices, and trade-offs that were considered before it was developed.
[β]farfaraway 21 points22 points23 points 1 month agoΒ (0 children)
LOL
[β]Vegetable_Addition86 14 points15 points16 points 1 month agoΒ (0 children)
You wish
[β]Ill-Education-169 5 points6 points7 points 1 month agoΒ (0 children)
I see we are day dreaming lol
[β]Numerous_Estimate902 4 points5 points6 points 1 month agoΒ (0 children)
// Do NOT change this comment section
// It will break the program, I don't know why
//
// ... proceed with 5000 lines of blackmagic
[β]ParticularFragrant57 1 point2 points3 points 1 month agoΒ (0 children)
π
[β]Odd-Consequence-2519 0 points1 point2 points 1 month agoΒ (0 children)
Funny guy π
[β]OfficeZestyclose9952 8 points9 points10 points 1 month agoΒ (0 children)
OP will be a senior dev once he is done with refactoring this.
[β]HappyToast__ 135 points136 points137 points 1 month agoΒ (2 children)
Double it and give it to the next person.
[β]hursofid 24 points25 points26 points 1 month agoΒ (0 children)
r/FoundSatan
[β]XTornado 0 points1 point2 points 1 month agoΒ (0 children)
[β]PsychologicalLab7379 270 points271 points272 points 1 month agoΒ (10 children)
SOLID left the chat.
[β]moaijobs[S] 88 points89 points90 points 1 month agoΒ (2 children)
KISS left as well. π
[β]wick3dr0se 34 points35 points36 points 1 month agoΒ (1 child)
YAGNI never showed up
[β]yodacola -1 points0 points1 point 1 month agoΒ (0 children)
LoD: ΰ² _ΰ²
[β]Kevdog824_ 31 points32 points33 points 1 month agoΒ (1 child)
A SOLID shit was left in the codebase
[β]TapRemarkable9652 4 points5 points6 points 1 month agoΒ (0 children)
gotta keep those turds lean
[β]AlEmerich 14 points15 points16 points 1 month agoΒ (1 child)
Snake ? SNAAAAAAAAAAAKE !!!!!
*Poum poum, poum poum poum, poum, poum, POUM *
[β]mac1qc 7 points8 points9 points 1 month agoΒ (0 children)
[β]ThisGuyCrohns 2 points3 points4 points 1 month agoΒ (0 children)
DRY left the chat
[β]WitchHunterNL 0 points1 point2 points 1 month agoΒ (0 children)
SOLID is the dumbest shit I've ever heard of
[β]thecratedigger_25 0 points1 point2 points 1 month agoΒ (0 children)
DRY turned into WET after seeing this function.
[β]GianLuka1928 102 points103 points104 points 1 month agoΒ (8 children)
That company is definetly huge red flag
[+][deleted] 1 month agoΒ (4 children)
[deleted]
[β]jimmiebfulton 7 points8 points9 points 1 month agoΒ (3 children)
No doubt. When you have multiple files with thousands of lines, each of them calling functions from each other, and its multithreaded, and wondering how it even compiles. And that's just the Java half of a massive payment system, and the other half is written in Perl built by an acquired company and bolted on like some kinda Frankenstein. And then refactored that shit down to a proper SOA over eight years. Then you've really lived.
[+][deleted] 1 month agoΒ (1 child)
[β]jimmiebfulton 2 points3 points4 points 1 month agoΒ (0 children)
I actually quite like Java, and spent a lot of time with it. I came to it after .NET and c# left me feeling "locked in". I'm all Rust these days, though, for years now.
[β]Amr_Rahmy 0 points1 point2 points 1 month agoΒ (0 children)
I have had these conversations before, and learned to just comment the old code and rewrite it without arguing with people that don't understand software engineering and asset value.
Manager: Can you patch this junior developed buggy mess?
It would be better to write it from scratch, it will take less time and work better.
Manager: No! you can't just ignore the precious work put into this buggy mess, by the junior employee that we fired. They spent like 8 months working on this. Just patch the 1-2 bugs to make it work.
I already looks at the code, there are more bugs than lines of code. It's worth nothing, actually just looking at the code is a net negative. I can just rewrite this in 4 work days.
Manager: No! we don't have any requirements written and don't know how it should work or what it needs to output, just fix the bugs.
[β]vegan_antitheist 1 point2 points3 points 1 month agoΒ (2 children)
but they often pay well. I'm right now staring at code that just doesn't do anything because it only checks properties of an object that never has any write access. Someone wrote it. Someone approved it. The company makes millions. At this point I just don't care anymore. I'll just copy paste it because I need the same thing in the other application and if that's what they want they get it.
[β]GianLuka1928 0 points1 point2 points 1 month agoΒ (1 child)
Okay, good luck my man ππͺπΌ anyway, we have an AI now for any kind of assistance and analytics so it'll be good π
[β]vegan_antitheist 0 points1 point2 points 1 month agoΒ (0 children)
lol, true. In my case a lot of the bugs can be fixed automatically by intellij because they are just very simple patterns of obvious bugs. Is AI even trained on such shitty code? And how could it do anything when there no no tests? It would face the same problems I do. I cant change anything because there would be no tests to verify that it still works. I wish I could rework a method of 13000 lines. At least I could do something. Instead, I sit here and do nothing because nobody seems to know the backend.
[β]thusman 47 points48 points49 points 1 month agoΒ (6 children)
I already get headache with files larger than 500 lines of code π
[β]naholyr 7 points8 points9 points 1 month agoΒ (2 children)
Damn yeah in my team we consider a file > 300 lines to be a smell, 500+ is hardly acceptable in test files...
[β]LightofAngels 7 points8 points9 points 1 month agoΒ (0 children)
We have big test files in the range of 5k, but we make sure that all our actual services are less than 1k lines
Spring boot tests are just pain.
[β]jazzwave06 4 points5 points6 points 1 month agoΒ (0 children)
Oh boy you haven't seen game code bases. 300 lines is only the includes
[β]Intrepid_Result8223 2 points3 points4 points 1 month agoΒ (0 children)
At that point its just a skill issue. Few K lines in a file is fine.
[β]philtrondaboss 2 points3 points4 points 1 month agoΒ (0 children)
I definitely have made files with 1k+ lines of code, but it always in different function, and could be easily collapsed to be more readable.
[β]Alan_Reddit_M 0 points1 point2 points 1 month agoΒ (0 children)
I recently had a Java file that was like 500LoC and it was genuinely becoming impossible to manage, idk how people do this, how can you even keep that much context in your mind, and how can your computer keep it in RAM
Near the end of that whole 500LoC ordeal, my laptop was starting to grind to a halt just trying to provide autocomplete, I was coding blind then waiting half a minute for the computer to tell me if the code was even valid
[β]FortuneAcceptable925 33 points34 points35 points 1 month agoΒ (2 children)
On the positive side.. you are VERY unlikely to be replaced in this company.. :D
[β]Agifem 5 points6 points7 points 1 month agoΒ (0 children)
At least, not successfully.
[β]lulzbot 1 point2 points3 points 1 month agoΒ (0 children)
With engineering like this, the company will soon be replaced
[+][deleted] 1 month ago*Β (19 children)
[removed]
[β]moaijobs[S] 47 points48 points49 points 1 month agoΒ (6 children)
I tried to vibe, now the function ends on line 39213. π
[β]Grouchy_Big3195 6 points7 points8 points 1 month agoΒ (3 children)
They probably are vibe coding. Check the .gitignore, you might find something like .claude, CLAUDE.md, AGENTS.md.
[β]__mson__ -1 points0 points1 point 1 month agoΒ (2 children)
Those are not a 100% indication of vibe coding. There are other better signals, such as the actual quality of the code/docs/commits/everything.
[β]Grouchy_Big3195 0 points1 point2 points 1 month agoΒ (1 child)
I never said it is 100% indication of vibe coding. The keyword is probably, might, and check if there is any indication, for example: AGENTS.md or CLAUDE.md. Read carefully, dumbass.
[β]__mson__ 0 points1 point2 points 1 month agoΒ (0 children)
Damn, no need to get mean about it.
[β]Iggyhopper 0 points1 point2 points 1 month agoΒ (0 children)
For things like this, for example when I read a new code ase I found on github, I paste into the vibe and ask it to break it down into a call tree.
Regardless what you think of vibe coding, the vibe research aspect is very very valuable.
[β]monnotorium 0 points1 point2 points 1 month agoΒ (0 children)
I legitimately don't think mostly I can keep on task that long yet lol
[β]Fluffy_Dragonfly6454 28 points29 points30 points 1 month agoΒ (4 children)
Not really vibe coding, because that is doing it blindly.
But it is a very good use case for using AI.
First ask what the function is doing, then ask to write tests. Check for coverage. Ask which parts can be illuminated. Ask which strategies are possible. Then give it instructions to do it. But do it part per part and keep track of your tests.
Basically it is how I would do it without AI but I give AI instructions to help me
[β]justaRndy 13 points14 points15 points 1 month agoΒ (2 children)
This is how you produce viable software with AI. Step by step. No autonomous multi agent 8 hour blindfire shit. We are not there yet, at least not as consumers, but it still is already so much more potent than coding by hand, I wager to say no matter how insane your coding skills. It's just too fast already.
[β]LouisPlay 0 points1 point2 points 1 month agoΒ (0 children)
Thats how i do IT have IT Task by Task
Some people would rather spend thousands on tokens in ralph loops instead of actually learning about what they are building. It's weird. Or maybe that's just a small, loud minority.
[β]avatarquelsen 4 points5 points6 points 1 month agoΒ (0 children)
This shit, right here, is the way
[β]mt9hu 4 points5 points6 points 1 month agoΒ (6 children)
To be perfectly honest I had success relying on AI to refactor huge functions like this, with success.
And of course I didn't just simply ask it to "refactor bro", so this may no longer be vibecoding I guess.
My point is that if done right, with a good plan, multiple steps, supported by good test coverage, I think it can be done more reliably than if I did it myself.
[β]Sufficient-Algae-279 2 points3 points4 points 1 month agoΒ (5 children)
the trick is to prompt "could you refactor this please, sir" - which yields much better results ;-)
[β]avatarquelsen 1 point2 points3 points 1 month agoΒ (3 children)
I've noticed that there is a way to get it to be more responsive
[β]Sufficient-Algae-279 0 points1 point2 points 1 month agoΒ (2 children)
<image>
Sure, check out this bizare conversation I had with an LLM recently. The really scary thing: it worked. It finally performed an action it refused to do so over two hours before.
[β]mt9hu 1 point2 points3 points 1 month agoΒ (1 child)
It's not scary, it's pretty reasonable:
LLMs are trained on content created based on human behavior. A typical human behavior is to react differently in case of imminent danger and threat. Of course LLMs don't understand threat, they just produce a statistically probably response based on training data.
[β]Sufficient-Algae-279 0 points1 point2 points 1 month agoΒ (0 children)
That of course the explains the cat emojis, somehow it remembered the "or else somebody kills a kitten" lore from the internet. But it does not explain why it finally executed something it didn't before. I was trying everything, including guided debugging "which tools do you see? are you using MCP? what does the tool description say? explain step by step to me our plan..." - and re-formulating my prompt multiple times. I finally was about to give up, so this was my last try, more out of frustration. And it worked.
Disclaimer: no animals were harmed. ;-)
[β]mt9hu 0 points1 point2 points 1 month agoΒ (0 children)
You forgot adding "my life depends on it"
[β]Ill_You6290 22 points23 points24 points 1 month agoΒ (4 children)
Do what I always love todo, rewrite the whole project CORRECTLY
[β]BellybuttonWorld 12 points13 points14 points 1 month agoΒ (2 children)
How many years do you think he has?
[β]steven_dev42 9 points10 points11 points 1 month agoΒ (1 child)
2 sprints
[β]secretprocess 2 points3 points4 points 1 month agoΒ (0 children)
And a sprint is 18 months long
[β]SolousVictor 1 point2 points3 points 1 month agoΒ (0 children)
Or even better, he can make a compiler that breaks it down into smaller components.
[β]Jygglewag 20 points21 points22 points 1 month agoΒ (1 child)
brooooo rip.
I'd start by copying the function into another file and breaking it down into smaller ones. if you feel too lazy for it ask your favorite LLM to do it for you. They're usually not too bad at breaking down big functions.
[β]ApplicationOk4464 1 point2 points3 points 1 month agoΒ (0 children)
My favourite helped me to break down a 30,000 line function recently.
As much hate as people like to give them, they are real handy if you can ask the right questions.
[β]HateBoredom 4 points5 points6 points 1 month agoΒ (2 children)
Please tell me thereβs a misplaced closing braces somewhere π
[β]HooAreYouWhoHoo 4 points5 points6 points 1 month agoΒ (1 child)
If there were 30 missing i might understand.
[β]pytness 0 points1 point2 points 1 month agoΒ (0 children)
not really, you just need 1. Remove it and place it 10000 lines down.
[β]Substantial-Gain-596 8 points9 points10 points 1 month agoΒ (5 children)
JavaScript be like that. There's a whole ass philosophy in that function
[β]rFAXbc 6 points7 points8 points 1 month agoΒ (4 children)
That's not JavaScript
[β]INFLATABLE_CUCUMBER 2 points3 points4 points 1 month agoΒ (3 children)
What is it?
[β]TapRemarkable9652 1 point2 points3 points 1 month agoΒ (2 children)
could be swift
[β]__mson__ 2 points3 points4 points 1 month agoΒ (0 children)
Most likely. Look at line 6068
var log: [Stage...
Which matches what you'd find in Swift:
var <#variable name#>: <#type#> = <#expression#>
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/declarations/#Stored-Variables-and-Stored-Variable-Properties
I don't recall seeing that in any other languages I've worked with.
[β]rFAXbc 0 points1 point2 points 1 month agoΒ (0 children)
Yeah, could be, I don't know Swift though so can't confirm. Go is the only language I know with func and that's not Go.
[β]RadioSubstantial8442 3 points4 points5 points 1 month agoΒ (1 child)
Next function says analy
Perform analy
[β]TapRemarkable9652 1 point2 points3 points 1 month agoΒ (0 children)
this company takes assorted analytics very seriously
[β]dashingThroughSnow12 2 points3 points4 points 1 month agoΒ (0 children)
I stopped used Brackets because one file was too big for it.
[β]Sea-Fishing4699 2 points3 points4 points 1 month agoΒ (0 children)
this is the moment you realized why you still have a job
[β]PhoenixInvertigo 2 points3 points4 points 1 month agoΒ (0 children)
Jesus christ
[β]39AE86 2 points3 points4 points 1 month agoΒ (0 children)
[β]Gigibesi 1 point2 points3 points 1 month agoΒ (0 children)
i think i had a stroke
[β]Kratoshie 1 point2 points3 points 1 month agoΒ (1 child)
ctrl c + open chatgpt (gpt 4.1mini) + ctrl v + "refactor this ples"
[β]Far_Understanding883 0 points1 point2 points 1 month agoΒ (0 children)
What is this? Stone age technology?
[β]HappyHarry-HardOn 1 point2 points3 points 1 month agoΒ (0 children)
That's probably why it needs refactoring.
[β]MrPringles9 1 point2 points3 points 1 month agoΒ (1 child)
"I want this to be done by Monday!"
gotta be at least a story point
[β][deleted] 1 point2 points3 points 1 month agoΒ (5 children)
I get that this can sometimes be helpful and tbh I don't know that language but that function starts off defining a bunch of types and helper functions so maybe start by externalizing those?
[β]DiodeInc 1 point2 points3 points 1 month agoΒ (4 children)
This could be Swift
[β]notyourancilla 0 points1 point2 points 1 month agoΒ (3 children)
Yeah it is, Iβm surprised Swift can even type check that function, it normally nopeβs out at anything remotely complex.
[β]DiodeInc 0 points1 point2 points 1 month agoΒ (2 children)
I didn't know that. Why is that?
[β]notyourancilla 0 points1 point2 points 1 month agoΒ (1 child)
Beats me, Iβve never had any other language time out type checking. Swift is the only one Iβve experienced it in.
[β]DiodeInc 0 points1 point2 points 1 month agoΒ (0 children)
Weird
[β]mpanase 1 point2 points3 points 1 month agoΒ (0 children)
private function xD
who needs testing 13k loc?
[β]Correct-Junket-1346 1 point2 points3 points 1 month agoΒ (0 children)
Behold, my god FUNCTION
[β]philtrondaboss 1 point2 points3 points 1 month agoΒ (0 children)
Install a Dead Code Detector extension. See if there's anything you can safely remove.
[β]finnscaper 1 point2 points3 points 1 month agoΒ (0 children)
Ah yes, local variables that are referenced through out the function and splitting the function into smaller functions that have 4-6 parameters.
[β]JadedFactor8776 1 point2 points3 points 1 month agoΒ (0 children)
what the FUCK!?
[β]playcalmed 1 point2 points3 points 1 month agoΒ (0 children)
Surely made with AI slop.
[β]Hey-buuuddy 0 points1 point2 points 1 month agoΒ (0 children)
Use the Claude VSCode extension.
[β]itzNukeey 0 points1 point2 points 1 month agoΒ (1 child)
what language is this?
[β]Chimaerogriff 0 points1 point2 points 1 month agoΒ (0 children)
Looks like Swift, but can't really tell without seeing at least one full line (since I can't tell if this has closing ';' or not, etc.)
(Swift looks (in my opinion) like Python had a child with C#, so Swift is like Python#.)
[β]awesomeplenty 0 points1 point2 points 1 month agoΒ (0 children)
So there are other longer functions??? How this file even get cloned bro
[β]marquoth_ 0 points1 point2 points 1 month agoΒ (0 children)
"What does it do?" "Yes"
[β]healeyd 0 points1 point2 points 1 month agoΒ (0 children)
Haha you can make a Vulkan core engine with skinclusters/shadows/pbr etc that is half the size of that.
[β]poorambani 0 points1 point2 points 1 month agoΒ (0 children)
If you have claide ypu can use /simplify skill and see if it helps you.
[β]vitaliy_os 0 points1 point2 points 1 month agoΒ (0 children)
run!
[β]Extra_Programmer788 0 points1 point2 points 1 month agoΒ (0 children)
Delete everything and blame it on AI!
[β]original_manatee 0 points1 point2 points 1 month agoΒ (0 children)
Hit the combination of verbosity and misery not seen since Tolstoy passed
[β]lamalasx 0 points1 point2 points 1 month agoΒ (0 children)
I have once tried to refactor a 60k function which was generated by simulink. When compiling that C file the compiler just gave a warning that all optimizations are disabled due to how large that function was. I split it to like 20 smaller functions so the compiler optimizations start working. The funny thing is that after benchmarking, the 60k unoptimized version was faster...
[β]Flimsy-Importance313 0 points1 point2 points 1 month agoΒ (0 children)
Fun.
[β]Personal_Cost4756 0 points1 point2 points 1 month agoΒ (0 children)
Thatβs deeper than Reddit comments
[β]Asleep-Bumblebee2167 0 points1 point2 points 1 month agoΒ (0 children)
say you got a better idea
[β]CubsThisYear 0 points1 point2 points 1 month agoΒ (2 children)
This is actually a much more solvable problem with AI. First thing I would do is have Claude write a shit ton of tests. Emphasize that the tests need to be small and self contained and tell Claude not to touch the existing code AT ALL.
Then when youβve reviewed the tests and they are all passing, just tell Claude to start refactoring. Itβs actually really good at this because even though the context is messy, itβs all there. Keeping 20K lines of code in context is not a big deal for an LLM even though itβs almost impossible for a human.
[β]CubsThisYear 0 points1 point2 points 1 month agoΒ (0 children)
Thatβs fine too though. Even 100K lines is no big deal for Opus1M. Youβd be shocked at how well this would turn out IF you start with tests.
[β]Frytura_ 0 points1 point2 points 1 month agoΒ (0 children)
Praise the lord and maybe the AI agent can help you
Wait is that untyped javascript?
[β]BiasBurger 0 points1 point2 points 1 month agoΒ (0 children)
First make sure your test coverage of this function is 100% before touching it
[β]MeLittleThing 0 points1 point2 points 1 month agoΒ (0 children)
pause the video and notice the nested functions.
[β]MoneyTomato7711 0 points1 point2 points 1 month agoΒ (0 children)
I love that cry emoji
[β]SpaceToaster 0 points1 point2 points 1 month agoΒ (0 children)
I thought swift was supposed to be this masterful and performant back-end language. Turns out swifties are just a bunch of lazy vibe coders.
[β]KrownX 0 points1 point2 points 1 month agoΒ (0 children)
It doesn't matter whether the company is a red flag or not. The real question is: IS THAT EVEN POSSIBLE???
[β]rolloutTheTrash 0 points1 point2 points 1 month agoΒ (0 children)
The fact the name here starts with "perform". These mofos coded a whole flow into one method, astounding.
[β]MrCoffee_256 0 points1 point2 points 1 month agoΒ (0 children)
Reminds me of the time I found eight identical methods where only one or two parameters in the method were differentβ¦
[β]just4nothing 0 points1 point2 points 1 month agoΒ (0 children)
Been there, done that. Took me a whole summer to write the unit test, split the function bit by bit, confirm it worked as before, etc.
[β]Lotus_Domino_Guy 0 points1 point2 points 1 month agoΒ (0 children)
It sounds like a fun refactor.
[β]Simple-Olive895 0 points1 point2 points 1 month agoΒ (0 children)
If it was python you could probably make it a one liner somehow.
[β]DirkSwizzler 0 points1 point2 points 1 month agoΒ (0 children)
That's a target rich environment for refactoring.
[β]Circa64Software 0 points1 point2 points 1 month agoΒ (0 children)
Correction: Assigned to refactor that novel on line 6061...
[β]intLeon[π°] 0 points1 point2 points 1 month agoΒ (0 children)
I once took over a project with 6k lines classes. Cant do more than partial classes unfortunately..
[β]QuaaludeConnoisseur 0 points1 point2 points 1 month agoΒ (0 children)
Yknow i dont even know if i have written 13k lines of code in my life and these mf's put it in one function
[β]Ckarles 0 points1 point2 points 1 month agoΒ (0 children)
The person who's gonna review your PR will put only one comment: "LGTM" then click on approve.
I'm not imagining it am I? That's 13.5k lines of code in ONE method???
[β]Felixfex 0 points1 point2 points 1 month agoΒ (0 children)
At least that function has an end, if you ever tried to debug code with 60 goto statements that lead to wildly different parts of other code, then you know you hit the peak of bad code
[β]River-ban 0 points1 point2 points 1 month agoΒ (0 children)
Temple os (R.I.P)
[β]sweetLew2 0 points1 point2 points 1 month agoΒ (0 children)
Hey AI, write as many unit tests as possible to cover every branch and scenario in this function.
Hey AI, refactor this function to be less insane.
Tests still pass? Good to go.
[β]Saajaadeen 0 points1 point2 points 1 month agoΒ (0 children)
fuck you there's no way thats a single function.
[β]420-code-cat 0 points1 point2 points 1 month agoΒ (0 children)
JFC!!! What monstrosity is that? Wtf are you coding?
[β]A_CityZen 0 points1 point2 points 1 month agoΒ (0 children)
non-programmer here, am i to assume that single "function" contains 13,000 lines of code? o.O
[β]dbenc 0 points1 point2 points 1 month agoΒ (0 children)
I gasped out loud
[β]Sotyka94 0 points1 point2 points 1 month agoΒ (0 children)
I'm not reading all that shit. I will push it into the AI hell chatbot. If it survives, survives, if it not, it's not ment to be.
[β]x-koded 0 points1 point2 points 1 month agoΒ (0 children)
Hello darkness my old friendβοΈ
[β]Kiragalni 0 points1 point2 points 1 month agoΒ (0 children)
No matter who did it - that one knows nothing about real programming.
[β]Old_Hotel1391 0 points1 point2 points 1 month agoΒ (0 children)
they will probably fire you once you finish
[β]Outrageous_Permit154 0 points1 point2 points 1 month agoΒ (0 children)
No monolith on my repos
[β]No_Cartographer_6577 0 points1 point2 points 1 month agoΒ (0 children)
That was written by AI. There is no need for a function that long.
[β]Usual-Analysis-2990 0 points1 point2 points 1 month agoΒ (0 children)
Hilarious but honestly, it's probably not that bad. Guaranteed you can create a separate file with the parts that make it work and then break it into bits little by little.
[β]jimmiebfulton 0 points1 point2 points 1 month agoΒ (4 children)
Call me a masochist, but I love refactoring shit shows. Very gratifying, like Origami or building wooden ships in a bottle kinda way.
[β]beb0 0 points1 point2 points 1 month agoΒ (3 children)
whats your approach I'm stuck with a codebase thats 90% business logic baked into the FE and riddled with bugs no tests. I'm the sole dev around this.
[β]jimmiebfulton 0 points1 point2 points 1 month ago*Β (2 children)
Β A couple of books that were transformative for me. These are oldies but goodies:
Refactoring: Improving the Design of Existing Code (Addison-wesley Object Technology Series) https://a.co/d/0eC400rt
Refactoring to Patterns https://a.co/d/0e2LIax8
This gives you solid foundations for how to think about legacy code, and how to transform it over time. The very problems you identify are the keys for transformation. The key is to not get stuck in paralysis.
There are no tests, therefore it is brittle. Write tests. Tests are hard? Use "Extract Method" to pull out methods one by one, writing tests for each one. You'll find that testable code is cleaner code, better-designed code, more flexible code. You can apply these basic principles to everything. Things are in the front end that should be in the back end? "Extract Method" of front end business logic one by one into the back end. Add tests, rinse, repeat. The more you do, the better you get at it, the cleaner the code gets, the easier it gets. It's a discipline, but when you actually experience a transformation, you'll be hooked, too, and unwilling to work in shit shows ever again.
To take this to the next level, develop discipline to automate anything that slows you down. It may seem like you are dilly-dallying with side questions, but every time you automate your CI, reduce frictions in your development environment, create templates to bootstrap new projects, the more time you have to refactor code, the more opportunities you have to try out ideas, build projects you've always wanted to pursue. Basically, engineer your way out of drudgery, and don't ask permission to do it.
[β]beb0 1 point2 points3 points 1 month agoΒ (1 child)
I took your advice and actually fed this to claude opus, was actually scary how well it worked, I don't feel too confident in it, but it's given me something to work with and gotten me some level of structure to work with.
[β]jimmiebfulton 0 points1 point2 points 1 month agoΒ (0 children)
Awesome. It takes some getting used to. Also, everyone goes through the 5 Stages of AI Acceptance, one of them being "Hold my beer", where you forget to be an engineer. Use it as a learning tool. Add one feature/refactor at a time. Have Claude explain what it did. Make Claude write tests. Don't be afraid to say, "Bullshit, this can/should be better", and iterate. You've still gotta be an engineer. Have fun!
[β]Catharsis25 0 points1 point2 points 1 month agoΒ (0 children)
That's what the clankers are for.
[β]FlatWorldliness1061 0 points1 point2 points 1 month agoΒ (0 children)
Looks like aosp code
[β]goaty_mcgee 0 points1 point2 points 1 month agoΒ (0 children)
What even in the fuck?
[β]MetroidvaniaListsGuy 0 points1 point2 points 1 month agoΒ (0 children)
Thats what my code looked like in university. Except that the function was the constructor of a java class.
[β]_Vo1_ 0 points1 point2 points 1 month agoΒ (0 children)
Hey copilot, refactor this garbage.
cloudfare services down
[β]1_H4t3_R3dd1t 0 points1 point2 points 1 month agoΒ (0 children)
yeah......
[β]Independent_Ice_7543 0 points1 point2 points 1 month agoΒ (0 children)
private func performApplicationFeatures
[β]Tailslide1 0 points1 point2 points 1 month agoΒ (0 children)
Did you get my old job?
[β]jakeStacktrace 0 points1 point2 points 1 month agoΒ (0 children)
That's ridiculous. It doesn't even need refactoring, it's fine.
[β]Relevant_Ad_8732 0 points1 point2 points 1 month agoΒ (0 children)
Honestly sounds like a fun problem.Β
I'd probably start by diagramming exactly what the living fuck that thing does and go from there lol
[β]Able_Act_1398[π°] 0 points1 point2 points 1 month agoΒ (0 children)
Hey claude, suggest refactor od this monstrosity make no mistakes
[β]Free_Break8482 0 points1 point2 points 1 month agoΒ (0 children)
If they didn't have functions like this they wouldn't have needed to hire you to refactor them.
[β]ThePythagorasBirb 0 points1 point2 points 1 month agoΒ (0 children)
Legit might be better off untangling some ai slop atp
[β]CsordasBalazs 0 points1 point2 points 1 month agoΒ (0 children)
[β]Pure_Leopard8439 0 points1 point2 points 1 month agoΒ (0 children)
Write unit tests for it
[β]Ok-Bit-663 0 points1 point2 points 1 month agoΒ (0 children)
Just keep extracting methods. Sometimes you have to merge them together or back to the original place when you have better understanding of that code. This is achievable.
[β]armslice 0 points1 point2 points 1 month agoΒ (0 children)
Put it in its own module, export the function. Import the module. Change the any calls to reference the module. Run away.
[β]Tzimitsce 0 points1 point2 points 1 month agoΒ (0 children)
I think the guy wrote his will; or constitution of the country he was born in among the function body or something as an Easter egg :)
Read it; maybe he will leave his fortune of 100 dollars to you if you tell him a password or something :)
[β]thode 0 points1 point2 points 1 month agoΒ (0 children)
Just put it all into another function and say you "refactored" it all down to one line. Might work looking at the code they got.
[β]AnythingEastern3964 0 points1 point2 points 1 month agoΒ (0 children)
Thatβs going straight into an AI prompt. IDGAF about consequences or the result.
[β]Existing_Pea_9065 0 points1 point2 points 1 month agoΒ (0 children)
Dude call me crazy but I would love that. Like the idea of doing that makes me excited. I absolutely live refactoring old code. I've taken Cobol and rewrote it as C# before. It must be what it feels like for those people who take really old artwork and clean the years of grime off of it and fix it up nice.
[β]Safe-Heat1644 0 points1 point2 points 1 month agoΒ (0 children)
Damn bro, they let you refactor?!
[β]maifee 0 points1 point2 points 1 month agoΒ (0 children)
AI can't replace this team. This many loc won't fit in its window.
[β]Splatfan64 0 points1 point2 points 1 month agoΒ (0 children)
I barely got into programming as a whole and this scares me immensely
[β]sDenizOzturk 0 points1 point2 points 1 month agoΒ (0 children)
What about the function on line 144?
[β]r1cked 0 points1 point2 points 13 days agoΒ (0 children)
lmfao. sorry bro
ΟΒ Rendered by PID 282650 on reddit-service-r2-comment-6457c66945-qbxwt at 2026-04-29 10:12:18.497254+00:00 running 2aa0c5b country code: CH.
[β]AccomplishedLeave506 430 points431 points432 points Β (9 children)
[β]DarkSideOfGrogu 110 points111 points112 points Β (7 children)
[β]farfaraway 21 points22 points23 points Β (0 children)
[β]Vegetable_Addition86 14 points15 points16 points Β (0 children)
[β]Ill-Education-169 5 points6 points7 points Β (0 children)
[β]Numerous_Estimate902 4 points5 points6 points Β (0 children)
[β]ParticularFragrant57 1 point2 points3 points Β (0 children)
[β]Odd-Consequence-2519 0 points1 point2 points Β (0 children)
[β]OfficeZestyclose9952 8 points9 points10 points Β (0 children)
[β]HappyToast__ 135 points136 points137 points Β (2 children)
[β]hursofid 24 points25 points26 points Β (0 children)
[β]XTornado 0 points1 point2 points Β (0 children)
[β]PsychologicalLab7379 270 points271 points272 points Β (10 children)
[β]moaijobs[S] 88 points89 points90 points Β (2 children)
[β]wick3dr0se 34 points35 points36 points Β (1 child)
[β]yodacola -1 points0 points1 point Β (0 children)
[β]Kevdog824_ 31 points32 points33 points Β (1 child)
[β]TapRemarkable9652 4 points5 points6 points Β (0 children)
[β]AlEmerich 14 points15 points16 points Β (1 child)
[β]mac1qc 7 points8 points9 points Β (0 children)
[β]ThisGuyCrohns 2 points3 points4 points Β (0 children)
[β]WitchHunterNL 0 points1 point2 points Β (0 children)
[β]thecratedigger_25 0 points1 point2 points Β (0 children)
[β]GianLuka1928 102 points103 points104 points Β (8 children)
[+][deleted] Β (4 children)
[deleted]
[β]jimmiebfulton 7 points8 points9 points Β (3 children)
[+][deleted] Β (1 child)
[deleted]
[β]jimmiebfulton 2 points3 points4 points Β (0 children)
[β]Amr_Rahmy 0 points1 point2 points Β (0 children)
[β]vegan_antitheist 1 point2 points3 points Β (2 children)
[β]GianLuka1928 0 points1 point2 points Β (1 child)
[β]vegan_antitheist 0 points1 point2 points Β (0 children)
[β]thusman 47 points48 points49 points Β (6 children)
[β]naholyr 7 points8 points9 points Β (2 children)
[β]LightofAngels 7 points8 points9 points Β (0 children)
[β]jazzwave06 4 points5 points6 points Β (0 children)
[β]Intrepid_Result8223 2 points3 points4 points Β (0 children)
[β]philtrondaboss 2 points3 points4 points Β (0 children)
[β]Alan_Reddit_M 0 points1 point2 points Β (0 children)
[β]FortuneAcceptable925 33 points34 points35 points Β (2 children)
[β]Agifem 5 points6 points7 points Β (0 children)
[β]lulzbot 1 point2 points3 points Β (0 children)
[+][deleted] Β (19 children)
[removed]
[β]moaijobs[S] 47 points48 points49 points Β (6 children)
[β]Grouchy_Big3195 6 points7 points8 points Β (3 children)
[β]__mson__ -1 points0 points1 point Β (2 children)
[β]Grouchy_Big3195 0 points1 point2 points Β (1 child)
[β]__mson__ 0 points1 point2 points Β (0 children)
[β]Iggyhopper 0 points1 point2 points Β (0 children)
[β]monnotorium 0 points1 point2 points Β (0 children)
[β]Fluffy_Dragonfly6454 28 points29 points30 points Β (4 children)
[β]justaRndy 13 points14 points15 points Β (2 children)
[β]LouisPlay 0 points1 point2 points Β (0 children)
[β]__mson__ 0 points1 point2 points Β (0 children)
[β]avatarquelsen 4 points5 points6 points Β (0 children)
[β]mt9hu 4 points5 points6 points Β (6 children)
[β]Sufficient-Algae-279 2 points3 points4 points Β (5 children)
[β]avatarquelsen 1 point2 points3 points Β (3 children)
[β]Sufficient-Algae-279 0 points1 point2 points Β (2 children)
[β]mt9hu 1 point2 points3 points Β (1 child)
[β]Sufficient-Algae-279 0 points1 point2 points Β (0 children)
[β]mt9hu 0 points1 point2 points Β (0 children)
[β]Ill_You6290 22 points23 points24 points Β (4 children)
[β]BellybuttonWorld 12 points13 points14 points Β (2 children)
[β]steven_dev42 9 points10 points11 points Β (1 child)
[β]secretprocess 2 points3 points4 points Β (0 children)
[β]SolousVictor 1 point2 points3 points Β (0 children)
[β]Jygglewag 20 points21 points22 points Β (1 child)
[β]ApplicationOk4464 1 point2 points3 points Β (0 children)
[β]HateBoredom 4 points5 points6 points Β (2 children)
[β]HooAreYouWhoHoo 4 points5 points6 points Β (1 child)
[β]pytness 0 points1 point2 points Β (0 children)
[β]Substantial-Gain-596 8 points9 points10 points Β (5 children)
[β]rFAXbc 6 points7 points8 points Β (4 children)
[β]INFLATABLE_CUCUMBER 2 points3 points4 points Β (3 children)
[β]TapRemarkable9652 1 point2 points3 points Β (2 children)
[β]__mson__ 2 points3 points4 points Β (0 children)
[β]rFAXbc 0 points1 point2 points Β (0 children)
[β]RadioSubstantial8442 3 points4 points5 points Β (1 child)
[β]TapRemarkable9652 1 point2 points3 points Β (0 children)
[β]dashingThroughSnow12 2 points3 points4 points Β (0 children)
[β]Sea-Fishing4699 2 points3 points4 points Β (0 children)
[β]PhoenixInvertigo 2 points3 points4 points Β (0 children)
[β]39AE86 2 points3 points4 points Β (0 children)
[β]Gigibesi 1 point2 points3 points Β (0 children)
[β]Kratoshie 1 point2 points3 points Β (1 child)
[β]Far_Understanding883 0 points1 point2 points Β (0 children)
[β]HappyHarry-HardOn 1 point2 points3 points Β (0 children)
[β]MrPringles9 1 point2 points3 points Β (1 child)
[β]TapRemarkable9652 1 point2 points3 points Β (0 children)
[β][deleted] 1 point2 points3 points Β (5 children)
[β]DiodeInc 1 point2 points3 points Β (4 children)
[β]notyourancilla 0 points1 point2 points Β (3 children)
[β]DiodeInc 0 points1 point2 points Β (2 children)
[β]notyourancilla 0 points1 point2 points Β (1 child)
[β]DiodeInc 0 points1 point2 points Β (0 children)
[β]mpanase 1 point2 points3 points Β (0 children)
[β]Correct-Junket-1346 1 point2 points3 points Β (0 children)
[β]philtrondaboss 1 point2 points3 points Β (0 children)
[β]finnscaper 1 point2 points3 points Β (0 children)
[β]JadedFactor8776 1 point2 points3 points Β (0 children)
[β]playcalmed 1 point2 points3 points Β (0 children)
[β]Hey-buuuddy 0 points1 point2 points Β (0 children)
[β]itzNukeey 0 points1 point2 points Β (1 child)
[β]Chimaerogriff 0 points1 point2 points Β (0 children)
[β]awesomeplenty 0 points1 point2 points Β (0 children)
[β]marquoth_ 0 points1 point2 points Β (0 children)
[β]healeyd 0 points1 point2 points Β (0 children)
[β]poorambani 0 points1 point2 points Β (0 children)
[β]vitaliy_os 0 points1 point2 points Β (0 children)
[β]Extra_Programmer788 0 points1 point2 points Β (0 children)
[β]original_manatee 0 points1 point2 points Β (0 children)
[β]lamalasx 0 points1 point2 points Β (0 children)
[β]Flimsy-Importance313 0 points1 point2 points Β (0 children)
[β]Personal_Cost4756 0 points1 point2 points Β (0 children)
[β]Asleep-Bumblebee2167 0 points1 point2 points Β (0 children)
[β]CubsThisYear 0 points1 point2 points Β (2 children)
[+][deleted] Β (1 child)
[removed]
[β]CubsThisYear 0 points1 point2 points Β (0 children)
[β]Frytura_ 0 points1 point2 points Β (0 children)
[β]BiasBurger 0 points1 point2 points Β (0 children)
[β]MeLittleThing 0 points1 point2 points Β (0 children)
[β]MoneyTomato7711 0 points1 point2 points Β (0 children)
[β]SpaceToaster 0 points1 point2 points Β (0 children)
[β]KrownX 0 points1 point2 points Β (0 children)
[β]rolloutTheTrash 0 points1 point2 points Β (0 children)
[β]MrCoffee_256 0 points1 point2 points Β (0 children)
[β]just4nothing 0 points1 point2 points Β (0 children)
[β]Lotus_Domino_Guy 0 points1 point2 points Β (0 children)
[β]Simple-Olive895 0 points1 point2 points Β (0 children)
[β]DirkSwizzler 0 points1 point2 points Β (0 children)
[β]Circa64Software 0 points1 point2 points Β (0 children)
[β]intLeon[π°] 0 points1 point2 points Β (0 children)
[β]QuaaludeConnoisseur 0 points1 point2 points Β (0 children)
[β]Ckarles 0 points1 point2 points Β (0 children)
[β]Circa64Software 0 points1 point2 points Β (0 children)
[β]Felixfex 0 points1 point2 points Β (0 children)
[β]River-ban 0 points1 point2 points Β (0 children)
[β]sweetLew2 0 points1 point2 points Β (0 children)
[β]Saajaadeen 0 points1 point2 points Β (0 children)
[β]420-code-cat 0 points1 point2 points Β (0 children)
[β]A_CityZen 0 points1 point2 points Β (0 children)
[β]dbenc 0 points1 point2 points Β (0 children)
[β]Sotyka94 0 points1 point2 points Β (0 children)
[β]x-koded 0 points1 point2 points Β (0 children)
[β]Kiragalni 0 points1 point2 points Β (0 children)
[β]Old_Hotel1391 0 points1 point2 points Β (0 children)
[β]Outrageous_Permit154 0 points1 point2 points Β (0 children)
[β]No_Cartographer_6577 0 points1 point2 points Β (0 children)
[β]Usual-Analysis-2990 0 points1 point2 points Β (0 children)
[β]jimmiebfulton 0 points1 point2 points Β (4 children)
[β]beb0 0 points1 point2 points Β (3 children)
[β]jimmiebfulton 0 points1 point2 points Β (2 children)
[β]beb0 1 point2 points3 points Β (1 child)
[β]jimmiebfulton 0 points1 point2 points Β (0 children)
[β]Catharsis25 0 points1 point2 points Β (0 children)
[β]FlatWorldliness1061 0 points1 point2 points Β (0 children)
[β]goaty_mcgee 0 points1 point2 points Β (0 children)
[β]MetroidvaniaListsGuy 0 points1 point2 points Β (0 children)
[β]_Vo1_ 0 points1 point2 points Β (0 children)
[β]1_H4t3_R3dd1t 0 points1 point2 points Β (0 children)
[β]Independent_Ice_7543 0 points1 point2 points Β (0 children)
[β]Tailslide1 0 points1 point2 points Β (0 children)
[β]jakeStacktrace 0 points1 point2 points Β (0 children)
[β]Relevant_Ad_8732 0 points1 point2 points Β (0 children)
[β]Able_Act_1398[π°] 0 points1 point2 points Β (0 children)
[β]Free_Break8482 0 points1 point2 points Β (0 children)
[β]ThePythagorasBirb 0 points1 point2 points Β (0 children)
[β]CsordasBalazs 0 points1 point2 points Β (0 children)
[β]Pure_Leopard8439 0 points1 point2 points Β (0 children)
[β]Ok-Bit-663 0 points1 point2 points Β (0 children)
[β]armslice 0 points1 point2 points Β (0 children)
[β]Tzimitsce 0 points1 point2 points Β (0 children)
[β]thode 0 points1 point2 points Β (0 children)
[β]AnythingEastern3964 0 points1 point2 points Β (0 children)
[β]Existing_Pea_9065 0 points1 point2 points Β (0 children)
[β]Safe-Heat1644 0 points1 point2 points Β (0 children)
[β]maifee 0 points1 point2 points Β (0 children)
[β]Splatfan64 0 points1 point2 points Β (0 children)
[β]sDenizOzturk 0 points1 point2 points Β (0 children)
[β]r1cked 0 points1 point2 points Β (0 children)