Hands-On Engineering Lead & Fractional CTO | Technical Coach | Guiding Organizations to Excellence
With over 15 years as a Senior …
In the previous post, we saw the limitations of AI developer tools. Yes, they are not perfect. However, they are still able to improve our productivity significantly.
This time, we’ll dive into how we can effectively use them to achieve a better development experience, higher-quality output, and faster delivery.
First, we need to understand our pain points to identify solutions. According to software.com’s Global Code Time Report, the median daily code time per developer is 52 minutes. Considering that most of us enjoy this activity most, this is a shockingly low number.
The rest of our time goes into the following activities1:
This list is not exhaustive but covers the most important items.
We can boost our productivity and happiness by making as many of the above activities as efficient as possible.
The two most exciting areas where AI can help us are text processing and code generation.
As we learned in the previous post, we shouldn’t trust AI tools unquestioningly. But that doesn’t mean they can’t be helpful. We should also pay attention to legal considerations when we use them - especially for work. We should keep these considerations in mind when we apply the following tips.
Reading through lengthy texts - especially poorly structured - is challenging. Large language models (LLM) are pretty good at extracting information from them.
For example, we could ask them to summarize the entire text so we can have a bird’s eye view of it. Then, if we need more detailed information about a specific topic, we can ask directed questions. It’s essential to ask for a reference in the original text to double-check the validity of the answer. There are many prompt engineering techniques to achieve this. Prompt engineering guide is an excellent site to understand them.
When it comes to user stories, we can identify them manually and create them from requirements using prompting techniques. Using a standardized user story template is beneficial so that AI will include all the necessary information.
Handling PRs is also easier with AI. When we send it, we can summarize our changes in free text (for example, Graphite does this). Reviewers can also generate a summary if the author didn’t create one. On top of that, they can prompt about different parts of the change to better understand it.
We can even request code examples based on language, library, or framework documentation. Like with StackOverflow answers, we shouldn’t copy-paste the code without understanding it first.
Compared to text processing, it’s even more exciting that LLMs can generate code from our prompts because they already know of many technologies.
Nvidia CEO Jensen Huang predicts that AI will kill coding. John Carmack, the co-creator of Doom and Quake replied to him with the following:
“Coding” was never the source of value, and people shouldn’t get overly attached to it. Problem solving is the core skill. The discipline and precision demanded by traditional programming will remain valuable transferable attributes, but they won’t be a barrier to entry.
Many times over the years I have thought about a great programmer I knew that loved assembly language to the point of not wanting to move to C. I have to fight some similar feelings of my own around using existing massive codebases and inefficient languages, but I push through.
I had somewhat resigned myself to the fact that I might be missing out on the “final abstraction”, where you realize that managing people is more powerful than any personal tool. I just don’t like it, and I can live with the limitations that puts on me.
I suspect that I will enjoy managing AIs more, even if they wind up being better programmers than I am.
So, could we use AI to replace software engineers? In a previous post4, we learned that requirements and code are different representations of the same thing: software behavior. Since it’s nothing more than transforming one representation to the other, theoretically, they could generate entire applications (including tests) from the requirements.
With current tooling, doing this wouldn’t be wise for the following reasons:
The solution is to follow the same process we do today: create the code one user story at a time. The changes will be more localized and easier to reason about. Also, we should have manual control over what is happening during development. What changes is that we’ll use AI to generate some parts of the code.
We already know from the post about software behavior4 that tests and code cross-verify each other. Therefore, we should write one manually and generate the other with AI. This way, we can ensure that the software works as intended. But which one should we write manually?
Tests and code are on a different abstraction level. Tests describe what the software should do, while code defines how.
Many developers focus on writing the code first and then adding the tests because they don’t like testing. It seems obvious to automate test generation because they dislike that part. However, this introduces a few problems:
On the other hand, manually writing the tests has many benefits over the previous way:
In other words, we reinvented test-first development (TFD). Currently, the industry prefers TDD over TFD. Primarily because it’s easier for humans to evolve the code incrementally, one behavior at a time, rather than writing it in one shot. AI tools don’t have this limitation; they can deal with more complexity and larger code blocks. In other words, they might bring the golden age of TFD5.
As of 2024, AI tools won’t replace software engineers. But they can significantly improve our productivity if we know how to use them. We must learn effective prompting and new working methods to utilize their capabilities.
In this exciting era, every developer has the potential to drive change and revolutionize how we work. Are you ready to do that?
This comic is an excellent representation ↩︎
At least for the few months before they wipe out humanity ↩︎
Hands-On Engineering Lead & Fractional CTO | Technical Coach | Guiding Organizations to Excellence
With over 15 years as a Senior …