AI Accordion
andre
At my day job, I decided to rewrite an internal website using AI coding tools. We have a simple web application that allows users to perform certain actions, but it doesn’t support automatic interface updates. As a result, users have to refresh the website often to see the current status of processing.
This is not very convenient, but it’s not a huge problem, so it would be a waste of time to rewrite the application from scratch manually, as the benefits would be quite small. However, I had the idea that this would be a very easy task for one of the modern AI tools like Cursor, which is pretty good at building standard applications. Long story short, in a couple of days, I had a working, fully-fledged website that did everything needed, looked way better than before, and was fully reactive, reflecting all changes in real time.
During my work with AI code generation tools, I noticed time and time again how fast they can generate new code. Unfortunately, they are quite eager to create the same code anew. This process is much like playing an accordion: the initial phase is expansion, where you let the AI agent write something substantial, stretching out the bellows to fill the space with fresh code. Then must come the contraction—refactoring to reuse more code, separating everything into smaller reusable components, and tightening up the whole mess. This expansion-contraction cycle is repeated time and time again, breathing life into the project. Quite often, left to its own devices, the AI runs amok and generates the code that we ask it to. Therefore, we simply must keep it on a tight leash! We need to identify all the problematic spots—in particular, opportunities for code reuse—and address them. This is, of course, a repetitive and iterative process where AI itself plays a large role, because it can review its own code and identify problematic areas. However, it is very common that our future artificial intelligence overlords make very strange decisions; therefore, a firm guiding human hand is still required. Quite often AI is unable to identify good opportunities for code reuse on its own, because some refactoring is needed first. Therefore, it always pays off to review the whole generated code carefully.
A better approach is to guide the code generation step by step, from the outset, splitting the target application into smaller reusable components. However, sometimes it’s easier just to ask the AI tool or agent to generate a substantial piece of functionality—that’s the expansion again. If it produces something decent, then the process of review and refactoring can commence, contracting it all down to something efficient and elegant.
Overall, AI can indeed deliver a very good performance boost in areas where the internet contains a lot of examples. This is true for Java- or TypeScript-based applications, Python, and a lot of stuff related to web development. However, tasks that are more subtle, use less common tools or languages, or require more complicated logic are often too difficult for AI code generators. Mind you, they will still produce “something”, but often this will be worse than nothing.
For any given task the AI can produce very good code very quickly, but it can equally spend a lot of time trying to fix something relatively simple and fail time and time again.
It can also fail miserably trying to do something that’s truly complicated or requires non-obvious code changes. Therefore, as I keep saying, in the current state of AI-assisted coding, humans are still definitely needed. A huge sigh of relief for us, meat puppets!
However, it is true, in my opinion, that the opportunities for junior developers, especially in the areas of UI and web development, are really limited nowadays. A pro subscription to Cursor, which costs $20 monthly, can easily replace such a junior developer and probably deliver even better results. Of course, particularly bright young minds can easily learn how to use these tools and achieve much more. But the majority of beginners are often quite horrible and often take years before they achieve decent code quality and development speed. Until recently the IT companies had no choice and hired the junior stuff anyway. Now the world is quite different.
In the long run, it’s of course impossible to predict how far this will go. In just a few years, we went from a pretty useless, if still impressive, first version of ChatGPT to tools that can provide very serious and practical assistance and seem to make at least some jobs obsolete. In 10 years, maybe AGI will be achieved, or some approximation of it, and therefore even jobs like mine will no longer be needed. Maybe we, senior developers, are living out our last good days before the sun sets on the whole profession. Maybe just a few very knowledgeable people will remain to give general directions to the AI tools, and those will do the rest of the work. Be that as it may, right now we should enjoy our good fortune while we can.