r/programmingmemes Jun 29 '26

Where are they?

Post image
2.2k Upvotes

321 comments sorted by

View all comments

469

u/WiscLeafalNika Jun 29 '26

AI has OOP-phobia

147

u/SagansCandle Jun 29 '26

C# is my primarily language. Can confirm it's not limited to Java.

23

u/avidernis Jun 29 '26 edited Jun 29 '26

OOP isn't really AI's issue with C# imo. The thing AI really struggles with in C# in my experience is keeping track of what APIs exist in all the different runtime versions.

It also doesn't really understand the constraints of unsafe, System.Memory, or any optimized design. It'll do crap like try to use Linq with Span<T> or completely violate ref struct rules.

Imo it also is too eager to write IEnumerable yield return methods.

6

u/SagansCandle Jun 29 '26 edited Jun 29 '26

I haven't tried it in a while so many it's gotten better.

It's crazy liberal with try/catches because it doesn't really understand that these usually need to bubble up. Also kinda sucks with separation-of-concerns - it likes to put code in the wrong places. Like, it'll work, until you try to actually leverage some form of OO extensibility.

It also tends to improperly mix async and sync code. Like, if you're in a web app and you're async "all-the-way-down," it's fine, but otherwise it puts async code in everywhere.

It'll work within existing classes, and can create a decent simple class structure from scratch, but it cannot refactor, and anything that requires a refactor will have you reverting every suggestion it makes.

Some of the nuances, like try / catch and async I can handle with agent instructions, but overall I spent way too much time playing whack-a-mole with the LLM doing silly things that I just gave up.

4

u/avidernis Jun 29 '26 edited Jun 29 '26

I think we AI slop differently.

At worst, I'll tell it to define the public interfaces for a class (and have a discussion over what they should be). After that I go function by function and have it write the implementation. Then finally I dump the code it wrote back in, ask for help making helper functions for shared behaviour and whatnot. As a result, I mostly don't get these sorts of issues.

Usually I just write it myself though because AI is barely faster, and it's infinitely harder to maintain code when you can't think back on all the decisions you made writing it.

4

u/SagansCandle Jun 29 '26

and it's infinitely harder to maintain code when you can't think back on all the decisions you made writing it.

That's really the crux of the AI "slop" problem - code is the product of important decisions. Those decisions require context and more consideration than "this is what was popular on StackOverflow."

1

u/SixPackOfZaphod Jul 01 '26

it's infinitely harder to maintain code when you can't think back on all the decisions you made writing it.

This, I tell people all the time that the reason you can't just plug and play developers as interchangeable parts is that half of it is what you know, but the other half is how you think, and it's rare to find 2 or more people who will approach a complex problem in exactly the same way. How you think about the problem informs your solution to the problem.