AI Code Needs Rules. TDD Writes Them.

It’s June now, and you know what that means — it’s AI month!

Just kidding. Every month is AI now.

So here’s the thing: if you’re vibe coding your way to rocket ship growth, you need TDD even more. AI-generated code is tricky to keep working right. Models tend to overwrite themselves, which makes it nearly impossible to know what your software actually does.

Tests written while practicing TDD are small, focused, and easy to understand. They act as a specification for the AI — and give you a way to verify that the output actually does what you intended.

Tests are the only way to have real confidence that even a small AI-built app does what you think it does.

And just to be clear — this applies to human-written code too!

To view or add a comment, sign in

More articles by Jonathan Bennett

  • Your Code Comments should <blink>

    There is a huge difference between code documentation and code commenting. Documentation can be super valuable and…

  • You Need to Copy This From Scammers ASAP

    I get a few dozen spam emails every day that all look about the same: Your bank account is compromised! Click here! You…

  • A Month-Old Bug and How I Found It

    In my previous post, I talked about a bug involving an invalid <turbo-frame> tag. The UI was fine when merged into…

  • One Commit, One Change

    I mentioned commits being too large yesterday. What do I mean by that? Here’s a simple rule of thumb I use: If your…

  • A Humbling TurboFrame Lesson from Yours Truly

    There’s nothing worse than code that’s almost right… I was helping debug an issue that came up with a client. They had…

  • Start Planning for Life After Low-Code

    I often get asked: “When should I use a low-code platform, and when should I switch to custom development?” I love this…

  • System Tests When They Matter

    My TDD workflow with a new feature is pretty simple: Create a system test walking through home page -> feature…

  • It Compiles. But It’s Still Wrong.

    I love strongly typed languages — but they’re no substitute for TDD. For example, let’s make an add function in Swift:…

  • Let Rails Help You – Now With Caching

    Thoughtbot recently published a great article on building a favouriting system in Rails using standard conventions. I…

  • TDD Helps You Scale Without Slowing Down

    Your specs are sharper, your team’s performing better, and your system is more reliable than ever. Besides that, what…

    1 Comment

Explore content categories