/** Depth first, recursive with an early return as the caller expects a single result. That’s the real payload. Fails loudly with an exception for the caller to handle, as per guidelines. **/
Bro chill, it’s just boilerplate code that’s looking for file within a folder structure.
From my experience ChatGPT never leaves any comments and always LGTM all code reviews (i.e., it doesn't find anything useful).
Claude leaves many code comments, and 99% of the time they are either explaining the line below like it's your first ever lecture in programming and you have no idea what assigning a variable does... or it goes full poetic and dumps a paragraph describing some piece of code that no longer exists that prompted it to write the commented piece of code. And during code review it dumps a huge list of 100 false positives where almost all of them are wrong, irrelevant or just nitpicks.
When AbstractFactoryInsuranceBeanInstanciator:43 calls createNewInstanceOfBeanInstanciatorClass:751 it uses StaticSingletonInstanciatorCache:52 which src/main/java/com/hobbits/feature/subfeature/ablabla:562 will then tickle.java:666 its balls.class:153 until com.hobbits.feature.common.infrastructure.synchronizer.AbstractOpenInstanciatiorSynchronizerImpl:71 syncrhonizes the beans.
My coleagues throw such slop as "code change requests" at me daily during code reviews.
Oh I ask it, and I have it established in my rules for every project, yet I find myself having to remind the little documentation whore every time it writes a function
Direct instructions on length often don't produce what you want. The model has to know what to include and what not to include in its output, and told to trim for length, it may choose poorly.
I found it helpful to establish a SKILL for code comments with directives on what makes a good comment, with examples. It still over indexes on those examples sometimes, but it's still better than a small poem in free verse about API endpoints.
The primary issue is I can't ask half my company to tell their Calude to be concise.
The secondary issue is that I use one common setup and switch between models based on my needs. I rarely need/use Claude, so I won't change my setup that works for every single model just to please Calude... which may then still ignore it.
I've spent a significant amount of effort trying to get it to make comments more like I do (concise, rarely more than one line, if just rewording a function name don't do it, and my own style of no space after the comment character and starting with lower case) and it'll follow it...a bit. It's one thing I hate about constantly retuning models, every time a new minor iteration comes out it'll change how it comments and I have to get creative bringing it back to earth.
I'm convinced the comments are part of the model's internal processing on some level, because if I try to force it to not do that, the output quality drops off a cliff.
I've had significantly more success having fixing the comments be a second pass.
But that's what actually happens. I don't know if it still works, but previously if you asked ChatGPT to perform basic math but tell it to hide its thinking process, it would spit out wrong answers.
Always remember that all the bells and whistles are ultimately just managing context. It's all context. That's all any harness is, ways to try and keep as much information as possible while feeding in as few tokens as possible.
Yes, it uses the comments for future context. However I learned that if the code and comments are out of sync, the comment wins and it will modify the code to match the comment.
If you are dealing with old code with someone that loved comments but didn't love keeping them up-to-date you have to force the LLM to ignore the comments.
Oh yeah, I've had a lot of issues with it in legacy code. It assumes things should make sense when instead they might just be legacy artifacts.
And it's part of why you have to have it cleanup comments on code it creates too. It assigns outsized value to comments, even when the comment is correct it will treat verbose comments as mission critical instead of incidental, and of course it bloats the context window over time if you don't keep it under control.
I came to the same conclusion about "It's not X, it's Y" in narrative text. If I force it to not do that, it starts making errors where it seems to assume X.
I've told mine very clearly: reasoning goes in docs/, history lives in git, not production code. code comments reference the docs explicitly where needed, code comments are mostly just what's easy to get wrong in the implementation. Keeping context lengths to <400k tokens with this, and a reasonably well structured project, and it's following it really well over many compact cycles and new sessions.
So for me, either the code is part of something important, then i review it line by line anyways and just delete comments etc.
Or its part of some sectioned of part, like part of the frontend or something where all that matter is that it works for now, where the AI can run rampant. Then i dont care about the comment and just assume its the documentation the AI needs to work better, probably part of the reasoning it does (all the server internal stuff except direkt input to output tokens is text based too)
True but not everyone can tell the quality of code. I can't. Doesn't mean I want AI slop though. So I just do a sniff test and see if they talk about AI anywhere or have more obvious AI in their other work, and if they do I assume everything they ever make is AI.
Yeah, see... that's why my comments are mostly rants and jokes that explains the thingy in the most comical way possible, my coworkers both hate and love it lol.
Yeah, !!x is weird, but it's ultimately just a shorthand for coercing values like Boolean(x) would do. Using != !, is just intrinsically confusing though, it makes you look at the code and wonder "is this intentional or is it a typo" instead of being able to trust that it's intentional (!! might make you question that some the first time, but once you've learned it, it's not questionable).
I think it’s questionable still. Explicit is better than being smart, always. Writing code is fast, and usually, most the time, you’re not writing, but reading your code. Does it take that much more time to write Boolean() instead of !!?
Also no tests. People were extremely bad about being diligent about writing tests. AI does the opposite and sometimes goes overboard writing frivolous tests.
It's because the humans that reviewed AI slop heavily penalized no tests, but didn't penalize recreating tests that already existed because it's fucking hard to notice that. You only have to skim the diff for the first one, but you need to review the whole tests directory in details for the second one. Same problem for the AI if they need to check btw. Maybe the harness could penalize covering a line of code that is already covered but coverage is an imperfect metric.
Penalty #1 is "the first one". Penalty #2 is "the second one".
In short: If the AI gets a penalty for missing tests, but no penalty for redundant tests, it will start writing redundant tests to reduce the risk of missing a test.
Tests are legitimately extremely important for AI-driven development, so I'm glad they're pushing them so hard to do it even without users asking.
But yeah, they do make some pretty silly tests. Especially when you don't force them to test the tests by checking the failure state.
Us humans are partly to blame though. I've always known writing tests was important even before AI, but I almost never did, and what tests I did write were probably pretty meaningless too.
I had a co-op that I asked to write a kalman filter for a specific task. Dude disappeared for two days and then turned in an entire class that did the kalman filtering, had explicit instructions for integrating in the program, had a hundred unit tests, and a ton of documentation.
Bro did not understand taking company code and putting it in whatever he used was a fireable offense. Specially after I told him he couldn't do that. And he was upset at us for the review afterwards.
I honestly don't understand people like that, it's so simple: if it's information that you cannot share with any random person you encounter on the street, then you shouldn't give that information to AI either.
I feel the same way about all those stories about AIs leaking API keys and other secrets: who thought it was a good idea to give AI access to secrets in the first place?
He had a graduate degree in something related and was enthusiastic to be asked to write that portion. So I assumed he would give me a earnest effort borrowed heavily from somewhere over the next few days. Wasn't supposed to be original and this was a one off R&D project that was fine if he came back two weeks with something that would marginally improved the behavior of what we were filtering with a short period for integration and some tunning.
We can't explicitly use these public models for several reasons, but didn't expect him to pull the the high school student turning in an essay written by a English grad student stunt.
On the other hand, frivolous tests aren't bad. They will break at the slightest refactor, but then the AI doing the refactoring will have to confront that fact and maybe improve the tests.
Frivolous tests can be bad, when they give you a false sense of confidence.
I had a kid a couple months ago submit a MR with tests included in the code and the tests were just nonsense. It was doing stuff like "create a native datastructure (Python dict), pass the datastructure as an arg to a function that just reads it and doesn't mutate anything, and then check that the values in the datastructure are still what they were initially created as"; if that test ever fails, it's above your paygrade, because the language is broken. It's basically just doing x = 1; assert x == 1 and acting as if that'll catch anything.
Well, that test could check that the method that is supposed to not mutate the object doesn't mutate it, someone could try to change that method in the future so that it mutates the argument.
No, in the context it's nonsensical. More specifically, it's a GET request that's fired off against the backend, so nobody could possibly know or care if the arguments got mutated internally. The "test" was dumping the return from the GET request and instead checking that the args being sent were still the same after the call as they were before. It was just utter nonsense that showed a lack of understanding of how tests work and the nature of the system purportedly being tested.
The point of a good test suite is that you know if you broke some functionality during a refactor. If you have to rewrite the tests, there's no guarantee the new test suite will have the same coverage.
Well, yes, but overtesting in that case isn't a problem. If your tests too closely parallel the code, they will be more brittle, but it doesn't introduce the chance to break functionality via a new edge case
LLMs don’t write good tests. They write stupid tests like “test that the correct implementation of the interface was called” instead of verifying actual behavior
My experience is LLMs go overboard with mocks unless you set up extremely tight guardrails and even then will "cheat" by using mocks if it gets into a point where the code can't be tested. Whenever I start to feel friction writing tests that a good signal to me that the code needs to be refactored to make it easier to test, which is something LLMs tend to not do.
I'm of the opinion that mocks do not do a good job of testing the observable behavior of the unit and am in agreement with the comment you're responding to.
Yeah also every task you ask it.. like calculate a bunch of things and copy to S3 and whatnot - it does all the stuff you'd have been to lazy like verify the copy afterwards, do numerical parity checks and whatnot. Recently when migrating some data it realized there was a slight issue with the numerics and found that the default quantization of the upgraded system changed. Would have been a silent failure nobody would have noticed for quite a while, I'm sure
In my experience its a lot of effort for not much return. On top of the tests themselves you have to often code things in an awkward way to avoid having to mock everything out, or worse you have to mock everything out, or worse avoid otherwise useful patterns.
And for that you get what? 95% of the time they only catch an issue with the unit test itself and not an actual bug impacting the actual system. And then faced with evidence that the whole endeavour is a giant waste of time someone will sigh and say, if only we were implementing TDD correctly and try to use this failure of TDD as a reason to further indoctrinate impressionable junior devs on the importance of wasting their days on shitty unit tests that dont actually test anything.
Automated functional testing and full end to end testing are useful. TDD is just something dumb that people got scammed by.
TDD works if it's something that you're not adhering to a real deadline. Plus you-or at least one person on the project-already know how to build it completely and how it should work.
It can also show you real quick which of your co-workers is terrible at procedural programming despite the test being open book and take as long as they need.
I find Test Driven Development to be great if you are addressing a real production issue and can reasonably recreate the failure scenario in your tests.
That also helps prevent this specific issue from cropping back up again, if you're able to write a test with a comment that says something like "Adding this test to verify we fixed the bug that caused Ticket # 1234."
Admittedly I've only been in the industry about 5 years now, but I've only used TDD on 1 service out of the ~50 microservices I've worked on.
It was a data query and calculation engine so we knew exactly what number should come out based on its input. Anything behaviour driven is much hard to write a unit test beforehand.
I find Test Driven Development to be great if you are addressing a real production issue and can reasonably recreate the failure scenario in your tests.
Is that TDD? The TDD people have the AI doing is writing tests before the very first line of code, and to implement new features, not merely fixing bugs on an existing product with users.
They do share methods and some of the associated benefits obviously, but what you describe sounds like just writing non-regression tests to me, not Test Driven Development.
TDD is writing tests you know will fail, then writing/refactoring code that will pass said tests, then going back to write more tests for more features
Compiler errors are a form of TDD, like TypeErrors and Syntax errors
Everyone uses TDD in some form... most are just using the IDE to do it for them
AI uses TDD because it's the only way for it to know if something works or not. One shotting isn't anywhere near as good as folks might claim without TDD. The agent will write a test, write code, then run the test, realize the test fails, and try to treat that as a new debugging session. End user only sees the final result with passing tests. In other words, AI's tests aren't there for future use, they're a mechanism to mock up what devs themselves do (create a small part of a project, run it a few times until they're happy, then move onto the next).
It's the best application of TDD. To prevent regressions. Outside of that TDD is pretty lousy, especially when you have Type Driven Development and are trying to figure out an elegant way of solving a problem. You might not know how the final API and code is going to look like ahead of time. And the "makes your code easily testable" is still easy to do when you define types and think in terms of functions and inputs/outputs.
I should have clarified that I also don't use TDD for new features, just fixing regressions. And as long as you write the test before fixing the bug in code, that counts as TDD!
TDD only works if you get fully defined stories with complete AC. And such stories are considered mythological as there are no verified reports of one being seen.
Even then, the fully defined stories are not going to tell you how to structure the API or the folder structure or what inputs and outputs are going to help you write the code internally.
What even IS test driven development, I literally don't understand it. Do you simply write all the tests first and write the code around it? How do you know what functions you are gonna test if you didn't write them yet? What if during coding you figure out a better way to write a bit of code that involves using 3 subroutines? You didn't write the tests for those so are they invalid? Do you go back to the tests and change them? Is that still test driven development? Do you have know in advanced that you are going making a discrete function that extracts some json data?
There was a bit of a debate at work about whether its acceptable to have AI write page long infodumps to explain its changes.
I was on the pro-side. That message helped me understand the change when we were working on it, so I know it will help me in a years time when I've forgotten everything.
The problem is the writing style is so obtuse, it'll take 10 pages to explain something where 1 page would have sufficed. Overly expensive vocabulary and flowery prose that makes the content look impressive, but often lacking substance (and occasionally just completely incorrect!)
I don't begrudge the correctness so much. I've had the misfortune of trudging through many a human-authored internal document that was just flat-out wrong. But before, the amount of sophistication put into a document was a signal for a level of care and quality into its contents. Nowadays, it just means I have to be even more careful in trusting it, because it's likely AI slop.
Can't you just tell it to be short, consise, and keep the explanation to 1 page length?
You could also have it write a long version and a short version then cut and paste the two versions so that things that dont need explanations are short and things that do are long
I said this elsewhere in the thread, but asking Claude to be concise does result in smaller output, but it often doesn't improve the result. The model needs to know what is important and what is not, to know what to include in its response. So just a simple "keep it concise" instruction will sometimes result in important details being omitted, sometimes to the point of making what would otherwise be a correct response incorrect.
I have my Claude code set to write decision records in ASD-STE100 language when I gig reasons for stearing it's direction. With each decision given a code that is to be referenced in the next got commit.
This way by looking at the code and the commits you can see why I asked for something to be done the way it was done.
I mean i assume the argument is between not writing anything at all and having Claude do the summary. Many many people just dont explain themselves in changelogs and such
You absolutely can, you can give it the exact instructions on how you want it to write documentation and you can put it in a CLAUDE.md file so it gets used every single time the AI writes something. People are in here acting like giving a 3 second prompt to an AI and having it go off and do something half baked is the AI’s fault lol
Trust me, if it was a simple fix, I would have fixed it by now. There's only so much the model output can be improved by instructions in the prompt. It's baked into the training to respond like this. Anthropic calls it "mannered prose" and they claim to have improved this with the latest versions of Claude but I haven't noticed it get substantially better from the Claude 4 generation.
If the info dumps are markdown files, then it's easier to find the right files if they're in their own branch like this. Just find the right commit, then you have the info. This is likely much easier with graphical git tools though.
If, however, the info dump is in-line comments, then you definitely don't want that in the main branch and can merge it all into a secondary branch. Use something like, "master_infodump" and switch to it if you need to view page long comments.
I might be misunderstanding something but that does not sound like very good advice. Why not use PRs and write the info dump in them? Or as part of a longer commit message?
You aren't supposed to keep around hundreds of branches. Around here, as soon as a feature branch is merged it is deleted from the repo. And if it's a local branch no one will be able to find it when they need it especially not your colleagues.
The post I was replying to said he wanted the info for his own purposes, but his coworkers did not. This is a way that he can keep the info available for his own use while not crowding up the repo for others.
I don’t think this is a straight yes or no. I have seen places where this was great, and in our code we have lots of huge readme style dumps that AI wrote. These are helpful for writing future code with AI, keeping documentation up to date, and getting up to speed on code.
But at the same time, these huge dumps take a lot of effort to read, and oftentimes the content doesn’t actually need to be that big. I have rejected multiple PRs over excessive verbosity. When you make comments, test plans, etc unnecessarily large you save yourself the mental load of simplifying things, and instead push that load onto every person who reads your code down the line, paying the price many times over
I've told it not to write code comments explaining why something has changed and instead let it write comments on the PR.
Makes the comments much cleaner. Sometimes I used to get things like // changed from 0.2 to 2.0 because this gives much better results for [...] at 2.0 instead of [....] at 0.2
Bingo. My boss told our lead dev to have his agent shorten its responses. I told our dev to leave the report his agents generate for me in verbose mode. I prefer the details, because it usually itemizes even small changes, and provides explanations for any changes to prior findings.
The ease of generating documentation for new feature adds and fixes is one of the less heralded benefits of AI.
You can tell if it was written by AI if the README/documentatiom is up to date but unnecessarily verbose and half incorrect, and it has 1207 issues to address but zero TODO comments.
You know how code is self documenting? Well, some misfits think that's not good enough and write a novel alongside the code describing how it worked 5 months ago
IMO, personally, I think good code is largely self-documenting as to what it does. But comments are still needed at times because "what the code does" might be easy enough to read at a glance, however "why the code does what it does", in certain sections, can be far more important and less self-evident.
I don't need a comment to tell me that the line is looping backwards through a list, you can read the code just as quick as the comment and know that; I need a comment to tell me that the code is looping backwards through the list for a specific reason and it should stay that way instead of being changed (unless the change takes that reason into account).
Documentation is a newly discovered part of a project. Some AI agents hallucinated text beginning with // or /* or # depending on the language and strangely the compiler ignored it.
Even worse the AI created multiple additional files the compiler completely ignored. It serves no purpose, it's properly a ploy used by the tech companies to increase the storage consumption of projects so you need larger storage devices.
This reminds me of how I feel when I go to a subreddit that is still very active, but then I click on the subreddit details and the about this community has links to tumblrs that have been closed for more than 10 years.
Pfft be real with AI if they aren't marking dozens of issues they aren't testing haha. I have a project with over 20 issues open but they can wait just like the old days
Sometimes I write comments apologizing to whoever has to maintain my code after I'm gone. (Joke's on me, they'll just rewrite it from scratch because that will be easier than decoding my regexes.)
I use deploynator to release the code, thus ensuring that the documentation is updated through ast analysis and other techniques with readmenator (pip install readmenator && pip install deploynator)
A lot of it to be honest was cope. I think a lot more devs working professionally have transitioned to using Claude code or alternatives so the opinion is slowly shifting.
I know mine has, I know how to program but I am mostly reading, reviewing, testing and challenging code atm. The quality is very good if you hold ai to standards and it's so much quicker.
2.0k
u/Copious-GTea Oct 20 '26 •
I can tell which model my coworker vibed with based on the comments it left.
238
u/coomzee Oct 20 '26 edited Oct 20 '26
My favourite is a KQL query.
| where X != !true
Have to say that made me laugh when I saw it in a PR
716
u/YeetCompleet Oct 20 '26
Also no tests. People were extremely bad about being diligent about writing tests. AI does the opposite and sometimes goes overboard writing frivolous tests.
118
u/TheColourOfHeartache Oct 20 '26
There was a bit of a debate at work about whether its acceptable to have AI write page long infodumps to explain its changes.
I was on the pro-side. That message helped me understand the change when we were working on it, so I know it will help me in a years time when I've forgotten everything.
48
u/ganja_and_code Oct 20 '26
You can tell if it was written by AI if the README/documentatiom is up to date but unnecessarily verbose and half incorrect, and it has 1207 issues to address but zero TODO comments.
19
u/Refloni Oct 20 '26
Readme is documentation
14
u/the_great_zyzogg Oct 20 '26
AI documentation will always be full and complete grammatically correct sentences. Almost like we're speaking The Queen's English.
Human devs (myself included) will be very brief and to the point. Like, one or two levels above caveman speech.
Honestly, I generally prefer reading the latter over the former. It gets to the damn point quicker.
24
u/CelebrationOdd7810 Oct 20 '26
Bold of you to assume my AI assisted project has documentation and a readme file.
54
u/10art1 Oct 20 '26
2024: I can tell this project is written by AI because it's slop
2026: I can tell this project wasn't written by AI because it's slop
14
u/NightmareJoker2 Oct 20 '26
Too accurate. 😂
15
u/ChickenPicture Oct 20 '26
I'm not familiar with this term, can someone explain?
4
u/Tipart Oct 20 '26
Hey at least you know those TODOs are not mission critical tho.
4
u/jackofslayers Oct 20 '26
This reminds me of how I feel when I go to a subreddit that is still very active, but then I click on the subreddit details and the about this community has links to tumblrs that have been closed for more than 10 years.
4
u/iggy14750 Oct 20 '26 edited Oct 20 '26
Agreed. Smells like human developer in here. :P
3
u/makinax300 Oct 20 '26
I keep my readmes up to date. I am just used to it.
Also I only recently started writing todos because vscode didn't highlight TODO for some reason.
But idrc about docs.
(It still doesn't, I just use micro now)
3
u/NerdWithAWand Oct 21 '26
Claude, add this to global instructions
5
u/arugau Oct 20 '26
just delete readme and delete the todo comments and bam you have a claude codebase
2
u/who_you_are Oct 20 '26
My AGENTS.md: add random TODO, do not update comment or documentation.
2
u/misterespresso Oct 20 '26
Pfft be real with AI if they aren't marking dozens of issues they aren't testing haha. I have a project with over 20 issues open but they can wait just like the old days
2
u/Jonathan_the_Nerd Oct 20 '26
I'm in this picture and I don't like it.
Sometimes I write comments apologizing to whoever has to maintain my code after I'm gone. (Joke's on me, they'll just rewrite it from scratch because that will be easier than decoding my regexes.)
1
u/chomu_lal Oct 21 '26
😂
1
u/New_Ruin9882 Oct 21 '26
The good days
1
u/SignalBake6872 Oct 21 '26
I use deploynator to release the code, thus ensuring that the documentation is updated through ast analysis and other techniques with readmenator (pip install readmenator && pip install deploynator)
1
u/retardpotatochip Oct 22 '26
it's too accurate
1
u/Crawfish1337 Oct 26 '26
But I enjoy writing tests :(
1
u/ManuelKick33 28d ago
It do be like that though
1
u/Dharul 26d ago
Prolly will last longer than the AI itself
1
u/DyCrew Oct 20 '26
also unresolved math operations
1
u/SleepWalkersDream Oct 20 '26
Oooh, that's me.
1
u/FAMICOMASTER Oct 20 '26
That's how you know it's a project worth looking at
1
u/PumpkinFest24 Oct 21 '26
Never will understand SE that read docs. Docs have an unknown truth value. The code is all true.
1
u/shwlob Oct 21 '26
My code is just so unexplainably bad I never have to worry about being accused of using AI.
1
u/The-Great-Cornhollio Oct 20 '26
I love this
-2
u/Artistic_Swing6759 Oct 20 '26
what happened to this sub? last i remember it was anti ai
0
u/warmhaze8pinksips Oct 20 '26
lmao the username is such a power move though
0
u/GraduatedSapphic Oct 20 '26
This is still preferable.
-10
u/Objective_Oven7673 Oct 20 '26 edited Oct 20 '26
That's user error.
AI will happily document, comment, update tests, and file followup tickets if you ask it to.
The problem isn't AI, it's the "engineer" saying nothing more than "fix it plz".
Edit: as a commenter finally pointed it, I read this meme completely backwards by inserting a comma where there wasn't one.
I leave my downvotes of shame for all to see.
-1
u/Maleficent_Memory831 Oct 20 '26
Wow, the credulousness of assuming AI does all that...