Do you understand your code? Like, really understand? 🤔
Or, in other words, are you using AI to write code? 💁🏼♂️
Full understanding of your code is slipping through your fingers 😬
This is expected, and possibly intentional, but a potential long-term disaster.
Here is how I am thinking about this, and how to be proactive about it 👇
You are not an architect
Before AI, you were an actual labourer: as close and deep into the construction site as you can get.
Every line of code was yours, meaning that you had a full picture of all the details 👀
With AI we moved into a more "architect" analogy, where you are the one defining the architecture, not actually building it.
But that's not really a good analogy anymore.
An architect still designs the system, and knows all the moving pieces. AI coding is beyond that point 😬
Lately, I am noticing I can be more and more vague in the prompting, and still get a great result.
That's great for "productivity" (short-term), but a disaster for my grasp of the codebase long-term 😬
You are no more an architect, you are the manager: just specify what you want done, and both the "architect" and "build" part are left on the AI.
As such, you are losing your grip on the details of the construction site 🙌
Is this an issue?
The most cunning problems hide behind promising progress.
And it's better to act as soon as you spot the writing on the wall.
Full reliance on AI makes you faster, but also slowly dumber and lazier over time 🫤
The solution I am adopting aims to keep the balance, and allows steady grow instead of decay:
- Full AI for repeated patterns and known implementations
- Some AI when setting up building blocks of the architecture
- No AI when I don't really understand something
Let me give you a few examples in practice.
Full AI
When the codebase is mature enough, I have the following in place:
- A set of repeated/obvious implementation patterns
- A solid set of types and
typechecksetup - An extensive set of custom linting rules
- A clear and repeated folder structure
With this, AI can go big and fast. And autonomous.
For most features, I already know what will be the updated files and the logic. Not much to learn, just let the AI do the work 🫡
The automatic checks will keep the AI code clean, and my review is usually a fast skimming to check for bad patterns.
If the file changes are as expected, and nothing caught my eye, then it's good to go as-is 🚀
Some AI
If the codebase is still early-stages, full AI is risky 😬
AI copies patterns, if no pattern is there to follow, bad patterns blossom 🙌
In these cases:
- Be more precise and thoughtful in the prompts (mention files and details for expected result)
- Manual changes and more attention in reviewing the code
The AI can still do the first pass, I clean it all up, take the time to add more custom linting rules if necessary, and overall set the right patterns.
No AI
This is your "zone of proximal development".
You are missing a few key details in how the final implementations would work, for real 🤔
AI could do it for you, but in your map of the codebase a new "blank" spot would appear.
Something happens there, it seems to work, but you don't really know why it does work (of if it really does work).
That's when you have to take a step back, and think ⚡️
Recent example for me: State Machines in effect (PR here).
I opened a sub-branch to expand the current work, and I went straight with AI
The AI writes it all, the AI tests pass, but I don't really know why or how.
I am missing the deep understanding that I need to build this module with confidence 💁🏼♂️
As such, I proactively took a step back, and I am now in the process of "manually" implementing this from the ground-up.
AI here is a tutor, tasked to read code from xstate and effect, and ask my questions. But the code and the decisions are all mine.
The goal is not "full manual code", but instead for me to really understand how it all works.
And actually writing the code is always the best strategy 🤝
AI is a slot machine. Maybe not by design, but it triggers the same action-reward loop. As such, you must be proactive and extremely conscious of how you use it.
Make sure to keep upgrading your knowledge as well.
See you next 👋
