The Incremental Engineer: My Workflow for Building With AI
The Incremental Engineer: My Workflow for Building with AI
You have probably read enough posts on AI, and I am putting yet another one before you. I promise I don’t intend to sell you a product or a course or tell you how I went from $0 to $80 million in six months. This is a post sharing my insights as I spend more time building with AI.
My first AI post talked about my experience building a web application with the help of AI and why I find the experience fascinating. This post in a continuation somewhat but more of sharing new insights and thoughts as I keep building.
What pleasures have I derived from building with AI?
In the beginning, when every social media post (it still is) was all about AI, I was sceptical. I have said this in a previous post, so just to re-emphasise the fact that I am not a hype train jump along person. However, in three months of focused work with AI as a companion, as I have no colleague on my app-building venture, I have nailed down a few benefits.
The Tech Fact Check Agent
I guess you have heard of hallucination when it comes to AI. It does happen, but I think it all depends on the tasks at hand. For information that is technically documented or specified, AI can be very accurate on that.
Building a small hobby app, keeping the system simple and maxing out the cheapest hardware possible, I needed to build a cron job for sending out push notifications for the app. This task will run every minute. I wanted to find out what happens to the cron job if the previous invocation didn’t finish. Why Google search when AI could help, so I turned to Copilot.
Copilot informed me the fact that kicking up a new job will spawn a new process. This informed my next decision: I would need a way for the starting process to exit if a previous one hasn’t finished.
Idea Validator
When I am thinking of a feature, I focus on the What, I describe the attributes of the model or feature I am hoping to realise. Without too much details, I hand it over to AI to propose a solution achieve these goals.
To illustrate an example, I needed to build a notification system that sends out Webhooks to a varying range of channels from Discord, Slack, Telegram and other webhook supporting targets. Below is the prompt I started with and an iteration of the idea.
Iteration 1
Iteration 2
Iteration 3
Iteration 4
In this iteration, there are a few spelling errors which I didn’t notice when sending to the AI, but the AI, being smart, figured out what I meant to say and did the right thing. News flash, I only noticed the typo now.
The Learning Agent
You may have a lot of years of experience working in a programming language. You may even be a main contributor to the programming language you are using. There is still a high chance that you still don’t know the available utilities your language provides. This is where AI can come in handy.
After getting AI to generate a bit of code, I review the code. I take a look at what is generated and most times it writes code I would but other times it does it in a way I naturally wouldn’t but it does seem elegant.
In my prompt session for fleshing out the webhook cli system, in order to implement a lock file mechanism, in order to ensure that the lock file is released after the task is completed, AI used the Python module atexit. I have never heard of it, but this has been part of the Python standard library since forever.
The
atexit
module defines functions to register and unregister cleanup functions. Functions thus registered are automatically executed upon normal interpreter termination.
Since I predominantly build web applications and not command**-line applications, there is very little chance I have needed to use this. Most likely libraries I use make use of it. So moving forward, if I ever need to do a clean-**up operation on exit of a file, I will turn to the module atexit.
The Iteration Workflow
Concluding thoughts
I am sure there are better approaches and maybe more academic and systematic approaches out there that one could apply. But like everything in life, apply what works best for your current situation. The benefit of working with AI is to quickly prototype and validate an idea, and not be too held down by the plumbing required to build a system.
You didn’t use TDD
I am not here to showcase TDD experience; I am here to quickly put a solution together and throw it away if it doesn’t seem right. Once I am satisfied and sure of an approach, I can now focus on adding as many tests as possible. Even get AI to highlight edge cases and write tests for those or document such. Also, this is an after work hobby, I have 2 hours max to be productive, so show me something working quick.
Did I read about using AI in a book or YouTube video?
Not really. I watch a couple of videos and listen to podcasts that talk about LLMs and solutions out there. But no matter how many resources you read up on, it is more important to build hands-on experience.
My usage of AI to write software keeps improving the more I use it. I can learn quickly what works, try different approaches and have AI exchanges with colleagues and friends. Just build something with it and don’t spend too much time reading all the books.
I am currently in a phase of building and not reading too much. I am simply using my experience in building software and playing the role of Architect, while AI does the plumbing.