r/java • • 6d ago

Telltale signs of Vibecoding in Java?

Someone recently flagged one of my mods as being "obviously vibecoded" (which it wasn't), so I appealed the decision. just out of curiosity, what exactly are the signs people are seeing when accusing code of being vibecoded?

101 Upvotes

164 comments sorted by

View all comments

Show parent comment

4

u/Zatujit 5d ago

isn't it the point of unit tests?

2

u/voronaam 4d ago

Not really. The point of unit tests is to cover the desired functionality, not to re-express the current implementation in assertions.

For example, if you have a "UserService", a good test might call a createUser method and then assert that getUserCount() == 1 and findUser(...) returns the creted users.

An AI-written test is quite likely to additionally reach straight into the DB with a couple of SELECT to assert the record is created in exactly the format it is done now, assert that a log line written as plaintext to a log file, assert that a metric usersCreated is emitted in Prometheus format, and also have a "no other interactions" assertion in the end.

Witch such a test and for no good reason it would be harder to switch from PostgreSQL to MongoDB, switch the loggers to structured format, add support for CloudWatch metrics or to literally add any functionality like queued up marketing events tied to user registration.

A human written tests cover the functionality that matters. If after creating a new user the total count of users is wrong - it is a bug. It is helpful to have a test that'd fail on it. The AI loves to write tests the cover everything else.

Another example is when the code has a bug. I've seen AI to find it - and happily cover it with a test. For example, human writing a test and finding out that "user names with a hyphen cause exception" would fix the exception. AI would write a test "hyphenated names are not allowed" - hugging the existing implementation insanely close, down to the exact bugs in it.