I have to admit, I was pretty blown away the first time I saw GitHub Copilot coding a full Kafka Streams topology in Java⦠just from the comments I had left in a Java class.
I was impressed. I thought to myself:
Whoa⦠this thingy is going to save me so much time coding for Kafka!
But, as with everything in life, you learn. And at some point, I caught myself thinking:
But, hang on, coding for Kafka is something I actually enjoy⦠why am I letting this agent do the part I love?
Thatās just me, though. What about you?
Hereās the takeaway Iām bringing today for our ongoing journey into becoming AI Native:
You write the acceptance testsā¦
Ask the AI agent to implement the code that makes those tests passā¦
Review the generated code, then iterate.
Do you like todayās edition? Share it with your friends šš»
Yes, I know. A lot of people love coding but dislike writing tests. Iām not sure I can convince those folks⦠but I can tell you from my experience: starting with tests improves your software quality.
When we start coding from the tests, thatās called Test Driven Development (TDD from now on), whose benefits Iāll share with you in a moment.
From my experience, using agents like Claude Sonnet 4 can get you about 75% of the way to code thatās mergeable in Git, which is pretty good. But that remaining percentage? Thatās where the real difference is made.
Donāt trust AI blindlyāit will write code āas best it canā based on the instructions you feed it. Always review the AIās code and tweak it to fit your actual needs and the proper quality. I stand by my statement, not only from my own experience, but also from others, as you can see in this graph taken from the State of Devops 2024. Quoting:
Participantsā perceptions of the trustworthiness of AI-generated code used in development work were complex. While the vast majority of respondents (87.9%) reported some level of trust in the quality of AI-generated code, the degree to which respondents reported trusting the quality of AI-generated code was generally low, with 39.2% reporting little (27.3%) or no trust (11.9%) at all.
But some of you might be wondering:
Marcos, why start with the tests when I could just work with the AI until it gives me both the code and the tests?
Two reasons:
1. We, as software developers, own the āwhat it should do.ā Weāve decoded the product specs from the Product team and we know exactly what our application must do.
The way to implement a solution with code might differāeach of us interprets specs in our own way, and AI is no exception.
You are responsible for how the app or feature should behave. AI is not trustable. Thatās why you need to write the acceptance tests to make sure of it. By doing that, youāre laying down the rails for the AI to implement the right code when you ask it to.
2. TDD has many benefits for our software, whether we like it or not. Iām not here to list every single benefit of TDD, but here are a few taken from various Dave Farley posts:
Fewer bugs.
More flexible code.
Better design.
Remember the workflow:
You write the acceptance testsā¦
Ask the AI agent to implement the code that makes those tests passā¦
Review the generated code, then iterate.
What do you think of this workflow? Want to tell me how it went for you? If so, send me an email at hello@ainativenewsletter.com or click this link šš»