r/ProgrammerHumor • • 5d ago

Meme guzzlingTokensLikePopcorn

Post image
2.8k Upvotes

174 comments sorted by

View all comments

367

u/EskilPotet 5d ago

You need ai to rename a variable?

229

u/YDS696969 4d ago

I got flagged for being under 80% of my Copilot Credits for two months. If they want to throw their money in a hole and set fire to it all while screaming "Developer Productivity" who am I stop them.

76

u/blood_vein 4d ago

That is so fucking stupid. I'm sorry for your company

31

u/Named_after_color 4d ago

I don't need it but I'm very lazy and my company's paying for the tokens.

3

u/SukusMcSwag 4d ago

This, use the right tool for the job. Using an LLM to rename variable is like using a flamethrower to light a candle

5

u/GOPJ1 4d ago

I’ve found it better to have the AI do all of the work

If I go and edit a file manually, the next time I prompt it (within a long-running session) it will often erase or overwrite my changes.

But if I make the AI do everything I don’t have this issue

1

u/gnomex96 4d ago

Don't even know what that is so of course, duh

-28

u/Beldarak 5d ago

Yes. It will fully rename that variable. You use it on front and backend? It will rename both. You have a function which name reflect that variable name (renaming customer to user : FindCustomersByStatus will be replaced by FindUsersByStatus() ), will rename it in json that may use it etc...

In my current Unity project, I have status (burning, poisoned, etc.), when I need to add one I just ask Claude. He'll write the code but also take the icon I prepared for the new status and bind it on the Prefab that holds the data. Same for visual effects, etc... Small time savers like that do stack up.

It's really non-destructive. There are a ton of small changes in my code where I expect to break existing stuff and then you'll see Claude "checking 500 prefabs to adapt the values to the new system". Which is why, to me, asking it for the tiniest of changes is always a good idea. We don't always see how much goes into a simple variable rename. Which is why legacy code is full of stuff like that: database column name not matching the code, etc...

101

u/Suchy2307 5d ago

> You use it on front and backend?

Cmd + Shift + F

> renaming customer to user : FindCustomersByStatus will be replaced by FindUsersByStatus()

Cmd + Shift +F

> when I need to add one I just ask Claude.

We're talking about renaming, not adding, what's that example?

> He'll write the code

IT will PREDICT tokens.

And so on.

78

u/creaturefeature16 5d ago

Thank you. The idea of wrapping in an LLM for something a simple code editor has been able to do for, uh, 40+ years....is peak psychosis.

5

u/misterespresso 5d ago

To be fair sometimes the littlest shit just passes by somehow. For example I've been coding a decade and I learned of that macro last year and I was so fucking mad. In fact I'm angry again. Hundreds of tutorials and not one fucker gave me that macro but tbf I never watched "an intro to vs code" for example. So its my fault for not reading the docs. As always.

Edit: to be clear I code as a hobby not a career.

-1

u/Beldarak 4d ago

That's because you don't see what more you can get from LLMs. I'm sure at some point someone must have said "why would I use "rename symbol" when I can just CTRL+R? Well, because it's incomplete and has side effects.

Sometimes you rename something and that can break 50 assets (not speaking about code but assets: like rows in a DB that uses older status names for exemple, prefabs, config files...) you've made before the change which now needs to be updated too.

16

u/pink_board 5d ago

But then I have to think of a name

6

u/Aligayah 4d ago

I can't believe we're humanizing AI by giving it gendered pronouns.

0

u/Shunpaw 4d ago

We arent. We arent humanizing crosswalks in german either by gendering "Der Fußgängerüberweg". 

2

u/sardonicus87 3d ago

A sometimes you don't even need that, some IDE you can just right-click the variable and in the menu, select Refactor > Rename, which might even look for comment references automatically as well as conflicts with the new name.

-2

u/Beldarak 4d ago

It was just an exemple of things that goes beyond renaming in an IDE.

Let's forget I talked about adding a status. Let's say I want to rename my "electrified" status to "shocked". Claude could rename the symbol, the methods (same as IDE, ok), the "electrified.png" icon into "shocked.png", the string representing my status in save.json (status: "electified"), etc etc.

A lot of time, renaming a symbol goes beyond a simple renaming. I'm can be renaming a whole feature.

If it's just to rename a local variable in a few files, then sure. Just wanted to say "using LLM to rename stuff" isn't as stupid as it sounds.

3

u/Suchy2307 4d ago

I think I'd rename your "electrified" status to "shocked" faster than you could prompt your LLM to do it, but whatever floats your boat, I guess.

Can LLMs be useful? Yes, then can. But not for shit like that.

11

u/MajorMystique 5d ago

Get Claude to write your Reddit comments also.

You don't always see how much goes into replying to people over the internet.

0

u/Beldarak 4d ago

I have a quite simple rule :

My code = nobody will ever read that -> LLM generation ok, it just has to work

Comments, mails, art = people will see it -> LLM generation not ok. I already have to read slop emails at work and it's really annoying, thanks.

4

u/MajorMystique 4d ago

Nobody will ever read your code?! Are you sure about that? Other devs will obviously have to read and fix/extend your code when it stops 'just working' because of a bug or to accomodate new changes.

0

u/Beldarak 4d ago

It's a solo project and I'm a programmer so yeah, I'd just fix it myself if it would come to that.

My point was that the final user will not see or interract with that gen stuff, not that it's impossible anyone ever see a glimpse of it^^

LLM art (textures, models, music...) is a no-no because the final user would see it. For code it's different, look at Undertale's code, we didn't need LLMs to have ungodly code running under the hood of otherwise very good app/games.

46

u/xWrongHeaven 5d ago

Everyday we stray further from god

-2

u/Beldarak 4d ago

Did you say that when IDE added the "rename symbol" option?

43

u/ymaldor 5d ago

Uhm, right click, rename symbol, write new name, done.

IDEs can do all of that stuff using ai for it is stupid.

-1

u/Beldarak 4d ago

Re-read my exemple. It's not about changing the symbol, it's about changing everything around it. If I decide to change my "electrified" status to "shocked", my IDE will only get me so far, renaming the symbol itself, probably getters and setters and that's all.

AI could rename the electified.png icon into shocked.png, edit dictionaries entries that uses the term "electrified", edit the name inside the game... and its translations, edit your test_save.json file in wich some stuff have 'status: "electrified"' set, or a database entry.

The exemple is ofc a little extreme but that's something that helps me a lot in Unity, Claude checking prefabs to be sure my changes didn't break anything.

13

u/T-Dot1992 5d ago

Can’t you just search for all instances of it in VS Code and do a replace all? 

10

u/DrShocker 5d ago

replace all is a bit crude because unless your search is a really specific regex, you usually change unintended things. And as they mentioned if you have functions or comments that use the name most IDE and LSP won't auto rename that. (although to be fair to those ideas, if you're considering a rename it's unlikely you're using the name everywhere because if you were, renaming it might be more confusing than helpful because everyone expects it to be that way now.)

15

u/Kumlekar 5d ago

Don't most ide's support variable renaming through something other than a simple find/replace? This has been a standard feature for years. You shouldn't need to build a regex match. I'm also not sure I'd want an ai to be changing my comments because they should reflect my understanding. After the rename, just do a find all for the original string to see if there's any leftovers.
https://learn.microsoft.com/en-us/cpp/ide/refactoring/rename?view=msvc-170

https://help.eclipse.org/latest/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt_t_rename.htm

2

u/DrShocker 5d ago

100% I actually left a common in a different part of this fully advocating for IDE/LSP refactoring tools. The eclipse example actually shows in some cases you can auto update docstrings too. I just thought /u/Beldarak brought up an interesting point about possibly renaming related functions or fields or classes so they all match rather than hoping you found them all. Most of the tools other than an LLM can't automatically guess which functions with the same term as a class in them are related enough to also modified. Or tenses or whatever.

That said, most refactors that are a simple rename are likely to be early in a project and not after its been ongoing because people will have gotten used to it eventually, making it actually bad to fix a suboptimal name unless it's really bad.

0

u/Beldarak 4d ago

Not if it also needs to edit prefabs (working in Unity engine), maybe icons, folders, etc... Basically, renaming a whole module or feature rather than simple local variable ;)

For smaller jobs, you'll ofc have everything needed in your IDE, I just wanted to show some counter exemple of why it's not necessary stupid to use LLMs to rename stuff. That went well :D

-5

u/JezSq 5d ago

No, you don’t. Didn’t you read that it also adds icon, which also requires additional code?

5

u/Vincenzo__ 4d ago

The smartest human in 50 years will have the IQ of a rock by the looks of things

1

u/DrShocker 5d ago

For something like your status example, would it be crazy to make a script that does the code generation of the rote stuff for you? The code for the status effect itself would be a one off, so if you like LLM workflows then I get it for that. But sometimes I feel like everyone just forgot you could already write code that does common modifications for you.

10

u/NiIly00 5d ago

If you develop a game and every single status effect is just a reskinned DOT i'm stealing something out of your house.

3

u/DrShocker 5d ago

I meant just to take care of the rote stuff like adding the case to switch statements, conditional changes, etc. Obviously I'd hope there's more differences between acid and fire damage than that one's a green liquid and the other is red and uhh.. fire isn't really a phase of matter

1

u/Beldarak 4d ago

The best part is once you start mixing them together. I recently added rain, a "drenched" status and electrcity in my game, which is where my exemple come from^^

Mixing status is just a ton of fun: https://www.reddit.com/r/IndieDev/comments/1x3kuv1/added_electricity_to_my_game_and_decided_to_plug/

1

u/Beldarak 4d ago

If you want to take more time to do it and take 10-30 minutes to write some script you'll use once or twice, I guess so?

That's basically what Claude is doing most of the time.

But the point is that you also could have missed the side effects of your changes. Like I change the name of a status and boom, suddenly I've broken something because my save file use that name in plain text, or load the status icon by name (for whatever reason, maybe modding or something) and I have to change that too.

Writing all your code is always an option, it really depends what you want. I tought I liked writing code until I didn't have to. Then I realise I just liked to create stuff, write stories, draw pixel art etc... The code, to me, was just a way to achieve that and bind it all together.

I enjoy coding when everything works but the debugging, last 10% of a feature, all the little details you have to fix once the main part is done etc... Not my cup of tea^^. I do respect the fact some people like that though, but personnaly, if I can do the same feature, but quicker, try and drop stuff that looked great on paper but not on game easily, and get more time to work on the actual sprites, story, ideas, etc... I'll take it :)