35 points SantiDev 2 hours ago 23 comments

Tweet URL: https://x.com/unclebobmartin/status/2080257779395154409?s=20

Robert Martin, the author of Clean Code, tweeted the following:

> I’m significantly older than you. I started coding in the late 60s. My current strategy is to not read any of the code written by my agents. That’s the only way I can take advantage of their productivity. What I do instead is to surround the agents with extreme constraints. Unit tests, gherkin tests, QA procedures, quality metrics, mutation testing, test coverage, and a plethora of others. In the end, I have very high confidence in the code they produce because they’ve had to run the gauntlet of all of my constraints and tests.

0xedwen 1 hour ago | parent

the expensive bugs are usually gaps in the spec itself

mirmor23 1 hour ago | parent

maybe the definition of 'clean code' in the agentic era should be changed to 'the code that complies to the specs, the design constraints and the exhaustive scenario test suite';

this is definitely a better outcome since all the human effort now shifts to spec, design, test scenarios tailored to the domain - as it should be.

having seen my share of human slop through decades (mine included), finally it's a relief to not have to deal with devs that don't have high standards, and the endless arguments/politics that ensue.

with llm it's just a text file away from compliance.

daaaaaaan 1 hour ago | parent

This is the guy that thinks optionals are too complicated? https://blog.cleancoder.com/uncle-bob/2017/01/11/TheDarkPath...

reliabilityguy 1 hour ago | parent

Interesting read. To his defense: the argument is not that Optionals are too complicated, but that it’s a wrong path for language design — instead programmers have to test their code properly.

I like optionals, but I see his point too.

ndriscoll 35 minutes ago | parent

Which is a stupid argument that completely misses the point. If you let the compiler prove that nulls (or other invalid states) can't happen (because null isn't a value of that type), then you don't need to test these impossible cases. So it's easier to ensure your tests are solid because there's not a ton of noise checking what happens inside of invalid program paths.

This does not require a new language feature every time there is a bug, as he asserts. It requires language features to let you be descriptive in your type definitions so that invalid program states don't exist by definition. You literally cannot write one down. It's the same idea as saying you can't assign a Monkey to an int64. Scala's ZIO also shows that in fact you can type-infer whether a given path will produce errors or nulls, so you don't need to have perfect knowledge up front or go back and change tons of code if that changes. Errors can automatically propagate, and you need to handle them once, somewhere. Checked exceptions were a fantastic idea; you just need to let the compiler infer them everywhere.

relativeadv 35 minutes ago | parent

Bob Martin has built a career on asking the wrong questions. He is doing the same here as well.

jvanderbot 1 hour ago | parent

The author of clean code (who makes his living consulting on how to write software) has pivoted to AI in a spectacular tweet about how to set up automated software development just in time to make his living consulting about how to set up automated software development.

rob74 15 minutes ago | parent

"How does Uncle Bob code today? Find out in Clean Vibe, the long-awaited sequel to the legendary Clean Code - coming soon from Prentice Hall!"

a34729t 58 minutes ago | parent

Well, he knows where is toast is buttered

paxys 37 minutes ago | parent

> I’m significantly older than you. I started coding in the late 60s.

Any opinion that starts with such a blatant appeal to authority can safely be ignored.

lovich 17 minutes ago | parent

It was a pertinent response to the end of the tweet he was replying to.

> Started programming in 1983. Old?

I took that sentence as asking if he was old because he couldn’t trust AI and uncle bob brought up that he was much older and trusted the AI output because he trusted his constraints and test harnesses

munk-a 15 minutes ago | parent

Appeals to authority aren't necessarily bad. I would hold an opinion on the internals of postgres from someone who worked heavily on postgres internals for forty years quite highly.

Robert Martin started coding in the late 60s and then became an author and a software design consultant - his statement defines the start date of his relevant experience but doesn't speak to the end date of that experience or the density of his experience. He has a wealth of experience but not in a field that's relevant to his comment.

I think an appeal to authority is a good basis for extending a bit of extra trust to statements - but you should always verify things yourself.

Cider9986 9 minutes ago | parent

Don't fall for the the fallacy fallacy.

anvuong 15 minutes ago | parent

This is the dude who ushered in the age of nonsensical boilerplate-ridden OOP code where you need to go down a bajillion of abstraction layers to see the actually implementation. Makes sense that he doesn't care about the bajillion lines of code AI produces as long as it looks good (on the surface).

remywang 15 minutes ago | parent

Does he read his tests and constraints? You’d need lots of tests to have that kind of confidence (SQLite has 500+ lines of tests per line of code), at which point it’s not a lot of additional work to just read the code.

jubilanti 14 minutes ago | parent

But does he read all those tests to know if they're right? Or does he just ask the LLM if the test it created were good?

nitwit005 14 minutes ago | parent

My current code base has more tests than runtime code. This sounds far more thorough than that. If you limit the possible productivity improvement to a small portion of total effort, it's inherently also going to be a small improvement.

Which, is fine, but not what most people are hoping for with these tools.

jordemort 10 minutes ago | parent

When my nephew went into computer science, I had to warn him about the bracelet cult people

hn_user82179 8 minutes ago | parent

andai 10 minutes ago | parent

I keep posting this but it keeps being relevant. I had an agent implement a feature completely backwards. It wrote a whole bunch of tests proving the correctness of the implementation. All the tests passed.

The really interesting thing to me is that formal verification wouldn't have helped there either -- it would have just written a mathematical proof of the correctness of the backwards feature.

wodenokoto 6 minutes ago | parent

So the next edition of clean code will be called “clean test code”?