r/AskProgramming • u/Relative-Baby1829 • Apr 25 '26
What are some tell-tale signs of AI generated code
Especially for solutions to leetcode style questions
0
Upvotes
r/AskProgramming • u/Relative-Baby1829 • Apr 25 '26
Especially for solutions to leetcode style questions
4
u/carcigenicate Apr 25 '26
Claude at least likes to add in comments for mundane stuff that doesn't need explaining.
8
u/MPGaming9000 Apr 25 '26
Imo I personally feel like it's not as easy to spot it in isolated functions. But if you look in a broader sense I think it's easier to spot. It's like trying to judge AI generation on a sentence vs a whole essay.
That said, in a broader sense I have noticed some more obvious tell tale signs, but some of these aren't specific to AI, just bad coding practices in general.
AI loves making wrapper functions and making no-op deprecations when you ask it to rework something. It makes wrappers that call other wrappers which call other wrappers. Layers and layers of crap that no human would ever do. It will make a function let's call it A which takes an input argument and adds 5 to it and returns that value. Then it will make function B which just calls A with a specific argument. And C which is similar to B but a different argument. No human would ever write that garbage, at least 95% of cases. People would just call A with a specific constant or something. It's so stupid.
Another example I can think of is, similar to what I just said, if there is a function A that has 30 lines of code, it will write a function B which does mostly the same thing as A but with a specific thing changed, instead of just making a single DRY function that just takes an arg and uses a switch case / conditional block or something.
So a lot of AI code is just way too overly verbose, needless repetitive, and bandaid fixes EVERYWHERE. And wrappers upon wrappers upon wrappers, no op functions to fulfill some interface... just absolute worse than junior level crap everywhere you look.
But trying to see this in a single isolated function, not so easy I feel like.
4
u/Melodic_Tragedy Apr 25 '26
Emojis
5
u/mailseth Apr 25 '26
Well documented and good test coverage.
2
u/Plus-Painter-2004 Apr 25 '26
I donโt read or write code all that often but an absurd amount of wrappers or helper functions that donโt make sense, like functions calling helper functions calling helper functions calling helper functions etc all bundled within like 3 wrappers
2
u/[deleted] Apr 25 '26
Unnecessary "********" to section off code.
2
u/ericbythebay Apr 25 '26
100% test coverage.
2
u/jacquesroland Apr 25 '26
Itโs not designed to be human readable. It will do things that work, but arenโt stylistic unless you give it instructions to do so.
2
u/EmeraldHawk Apr 25 '26
I have also seen Claude make unreachable code inside redundant if statements. Like:
if color.startsWith('green') { return true; }
if color.startsWith('greenish') {return true; }
Claude doesn't seem smart enough to know the second if statement will never return true.
1
u/greensodacan Apr 25 '26
Things I've seen:
I'm sure there are more.
1
u/jlew24asu Apr 25 '26
Perfectly made READMEs
1
u/Malechus Apr 25 '26
Broadly impactful refactors for small feature adds that could have been done without touching existing code.
1
u/gzk Apr 25 '26
Perfect grammar in comments
1
u/Ok_Software_2142 Apr 26 '26
Anything that's incredibly documented is usually a dead giveaway, but two things I also found that pop up are:
1
u/marrsd May 18 '26
Who's asking, the recruiter or the candidate?
18
u/[deleted] Apr 25 '26
[removed] โ view removed comment