As a software developer, I firmly believe that practicing coding katas can greatly enhance our skills in Test-Driven Development (TDD). It’s a fantastic way to improve our ability to write clean, efficient, and maintainable code while following the principles of TDD.

Moreover, I’m a big fan of pair programming, where two developers collaborate on a task while working together on the same computer. I find that pair programming can be a powerful way to enhance our overall development skills and produce higher-quality code.

Recently, as an experiment, I decided to take my skills to the next level and engage in a coding kata with ChatGPT using the ping-pong pair programming technique. In this post, I’d like to share my experience with this unique form of collaboration and how it helped me sharpen my skills in TDD, coding, and pair programming.

The experiment

I decided to practice using the well-known Leap Year kata. To get things going, I created the first test following the Arrange-Act-Assert pattern. Next, I feed the code to ChatGPT.

1

I was surprised to see the first results. As this is a well-known coding kata in the community, ChatGPT was able to infer the whole solution.

2

At this point, I tried to enoforce ChatGPT to follow TDD principles by getting only the necessary code.

3

Apparently, that made the trick but, as soon as I entered the next test, it provided me with the whole solution again.

4

5

At this point, I didn’t see the point on continuing with this approach so I tried a different one. I always try to use meaningful names on my code, but maybe this time it was giving too many clues to ChatGPT. I tried hiding the intention of the code by giving the test a more opaque naming.

6

The new approach worked well for the couple first iterations and the results were a bit more promising (bearing in mind that my intention was to follow TDD principles).

7

Later on, it didn’t come as a surprise that, after the third iteration, the model was able to get the full solution again.

8

Afterthoughts

In conclusion, the experiment with ChatGPT was a fun and unique experience that allowed me to practice coding katas in a different way. It was an good opportunity to test my skills in TDD, coding, and pair programming while also exploring the capabilities and limitations of a language model like ChatGPT.

I found the exercise to be very productive in terms of improving my skills while also providing an opportunity to collaborate with an AI language model. It was a great way to sharpen my skills while still being able to experiment with ChatGPT’s capabilities.

Overall, I recommend trying out pair programming and coding katas with a language model like ChatGPT, as it can be an excellent way to enhance your skills as a developer and explore new possibilities in AI-assisted development.