跳过导航
Morning Bathrobe Rant: CRAP.
0:00 / 3:45

Morning Bathrobe Rant: CRAP.

Uncle Bob Martin

@unclebobmartin29万 位关注者

在 X 上查看
416 个赞下载原帖

26,411 次观看

Morning Bathrobe Rant: CRAP.

47 条评论

评论来自 X (Twitter) 上的原帖

  • Bored Devops ☠️🛠⚙️ 的头像

    @syntoythesis

    I think picking an acronym and then figuring out what it means is SHIT. And by SHIT, I mean Shoe-Horning In Terminology. 😉

    7 个赞

  • Bored Devops ☠️🛠⚙️ 的头像

    @syntoythesis

    👏

  • Kenneth Eversole 的头像

    @kennetheversole

    This man is living the dream. Talking shit and living some where with an incredible view

    3 个赞

  • RC 的头像

    @RCallsign

    How do I tell it to cut the CRAP if I don’t know the acronym definition? I bet it will figure it out. I’ll try it on my project proposals

    2 个赞

  • Uncle Bob Martin 的头像

    @unclebobmartin

    It will figure out the acronym. Also, have it write a crap tool specific to your application. Don’t run somebody else’s crap tool. You can use one of mine as a template if you like, just tell the AI to look at it and then write one for your application.

    7 个赞

  • Zach Frey 的头像

    @znfrey

    @RCallsign Still trying to wrap my brain around this recommendation. Why is it helpful to have CRAP tooling that’s application-specific? Language-specific is obvious, and I can see language + framework specific, but what do I get out of the next step to application-specific?

  • Uncle Bob Martin 的头像

    @unclebobmartin

    Crap depends upon two separate metrics. Coverage and Cyclomatic Complexity. CC is language dependent. Coverage is architecture dependent. In a simple monolith coverage is pretty simple to measure. But if you a system composed of N threads it gets trickier. N processes makes it even trickier. N services makes is even trickier than that.

    2 个赞

  • Zach Frey 的头像

    @znfrey

    @RCallsign Aha! That explains the disconnect. I’m thinking of coverage only in terms of source line coverage or branch coverage. Thanks! Is there somewhere you already explain how you work out your coverage analysis?

  • Uncle Bob Martin 的头像

    @unclebobmartin

    I generally use the standard coverage tools. I have also asked the agents to build custom coverage tools. Here's one of the secrets to using AIs. YOU don't have to figure out the details of how to do it. You just need to tell the AI what you want. You have to be smart about it, and have the insight to know when they are "lying" to you. But for the most part you can just say things like: "I've got three processes that communicate with each other, and I want to measure the overall test coverage that follows the thread of execution through each."

    4 个赞

  • Richard Askew 的头像

    @ricaskew

    I have used cyclomatic complexity and test coverage with Claude Code . Claude Code’s comments on the tools: “Cyclomatic complexity — measures the number of independent paths through code. High complexity = harder to test, harder to reason about. Tools: radon (Python), lizard (multi-language). Test coverage — measures what percentage of code paths are exercised by tests. Tools: (Python), pytest-cov.”

    1 个赞

  • SweatSpots 🏃🏼‍♂️ 的头像

    @sweatspots_com

    CRAP index! Will give it a try. Maybe Claude Code will produce less crappy code. My 2 cents to force AI to refactor code. Set a max lines per file. If the file has too much lines, then AI has to refactor to pass the quality gate.

    1 个赞

  • Uncle Bob Martin 的头像

    @unclebobmartin

    @SquidCorp_ink Instead of setting a max lines per file limit, I tell the agent to split any file that has more than N mutation points. The mutation tester I had the agent build has a scan mode that reports the number of mutation points, without actually mutating them.

    5 个赞

  • SweatSpots 🏃🏼‍♂️ 的头像

    @sweatspots_com

    Interesting approach. I was also considering a token approach. What if the limit was tokens? The agent already thinks in tokens, so a token budget per file is more natural than a line or mutation points count. Curious to have your opinion on that.

    2 个赞

  • Uncle Bob Martin 的头像

    @unclebobmartin

    @SquidCorp_ink I've tried to ask the agents to measure their tokens. They seem unable to comply.

    1 个赞

  • SweatSpots 🏃🏼‍♂️ 的头像

    @sweatspots_com

    Yeah agents are bad with mathematics, but it could be done afterward, in a quality gate. /!\ this file has to many token! refactor.

    1 个赞

  • Omer Gronich 的头像

    @OmerGronich

    That last part was crucial. Don’t set the agent on the warpath to reduce CRAP without setting up acceptance tests first! Removing a bunch of code is much easier for an AI to do to get better CRAP scores than actually refactoring 🙈

    1 个赞

  • Uncle Bob Martin 的头像

    @unclebobmartin

    Yes, it's hard. Clickbait culture drives politicians to hyperbole. But some are worse than others. Some lie in their hyperbolic pejoratives more than others. Choose wisely -- not emotionally.

  • Omer Gronich 的头像

    @OmerGronich

    🤔

    1 个赞

  • Marcel Albrecht 的头像

    @shell839

    @unclebobmartin There was another political post he made, so maybe he replied to the wrong comment lol

    1 个赞

  • Uncle Bob Martin 的头像

    @unclebobmartin

    @OmerGronich Yeah, I hit the button on the wrong post. Sorry about that.

    2 个赞