BairesDev
  1. Blog
  2. Software Development
  3. Write Code Like It’s 2010: Why AI Assistants Create Technical Debt
Software Development

Write Code Like It’s 2010: Why AI Assistants Create Technical Debt

AI coding assistants are all the rage nowadays, but be careful. They are not the perfect developer some make it out to be.

Rocío Belfiore

By Rocío Belfiore

As Chief Research and Development Officer, Rocio Belfiore heads internal software development and boosts BairesDev's growth with her specialized teams.

14 min read

Featured image

Look, we are all excited about AI assistants. If you check your social media, you are bound to find dozens of posts of people going on about how they built the biggest, most impressive app ever, using nothing but ChatGPT and without knowing how to code. To that, I say, Lies! Lies, I tell you!

While I love ChatGPT, developed by one of the world’s leading AI development companies, and have used it to successfully learn new programming languages and my way around Blender and Unity, it’s not a wizard; it can’t cover all the potential bugs in a single tutorial. Even if you ask for detailed instructions, it’s bound to make a few mistakes, and it’s going to take you quite a bit to get a fully functioning answer.

But perhaps the worst problem is that ChatGPT data is just outdated. I mean, it does have the decency to tell you, “Hey, my cutoff point is 2021, so, like, I’m going to make stuff up from this point forward, ok?”. Look, if we were talking about a history book, or a recipe to bake a cake, I’m sure that ChatGPT would cook up a fully functioning answer in seconds.

But this is the tech industry we are talking about; this is the world where one day, everyone is part of the React cult, and the next day Svelte reigns supreme. This is the land of ever-changing paradigms, of waterfall, hybrid, and mixed methodologies duking it out. 2021 is like the Middle Ages or something.

Envision this: You’re immersed in a complex project, under the impression that your newly acquired AI Assistants will expedite your work. Yet this perceived efficiency is a mere illusion. The modern AI, akin to a time traveler stuck in 2010, writes outdated code, fostering a massive technical debt. This is a pressing issue that many individuals grapple with, a topic often neglected despite its potential to devastate our projects if ignored: the hidden costs of AI relying on antiquated code.

What Exactly Is Technical Debt?

Technical debt is a silent predator lurking within the codebases, poised to prey on unsuspecting developers. To illustrate, let’s revisit that complex project. Constrained by a tight deadline, you resort to taking shortcuts while crafting your code. Despite recognizing the existence of superior methodologies, you choose to compromise for the sake of expediency, thereby sacrificing stability and potentially introducing bugs.

Technical debt, in essence, signifies these compromises made for immediate gains at the cost of long-term stability. The situation becomes precarious when these hastily implemented fixes and workarounds accumulate and present an overwhelming barrier to future development.

Let me use an example to tell you what technical debt is. A couple of weeks ago, a friend asked me to help with a project. He was working with a very famous artist and needed someone to build a VR experience for the presentation. Me, being the absolute “yes I can” person that doesn’t know how to say no, said, “of course.” I’ve done a little bit of work with Unity before. What’s the worst that could happen? (A lot.)

First, if you’ve ever had to deal with a picky customer that is never satisfied with your UI, then take that person, multiply it by a thousand, and that’s what it feels like coding for an artist. It was an amazing experience, but there were moments where I honestly thought that no jury would condemn me if I strangled the guy.

All joking aside since we only had one week to set everything up, I booted up ChatGPT and started asking for tutorials on how to design a VR experience in Unity. Queue code that doesn’t compile, me copy-pasting the error and going in circles, I swear that ChatGPT was one message away from “have you tried restarting your computer, sir?”.

After a lot of trial and error, I finally managed to get the thing working, except there was an issue, not an error, mind you. Some of the methods I used were deprecated and would be removed in a future version of Unity. I could feel the sword of Damocles over my head.

We had to get everything ready, so, you know, if it works, use it; you can always refactor the code later, right? And here you go, my good people, a healthy dose of technical debt—would you like a receipt?

In the foreseeable future, while attempting to rectify bugs or introducing new features, you’ll inevitably encounter intricate spaghetti code, left behind by you or another developer in a state of haste or distress. Attempting to decipher the logic behind this code is akin to navigating a maze guarded by mythical beasts hellbent on annihilating your sanity. That’s a monumental technical debt.

I swear, my past self is my worst enemy. I’m inspired writing code, and it seems so obvious that I don’t want to waste time commenting on it, only to open the file a week later and waste time trying to remember what I was doing. Don’t be like me kids, comment on your code.

The horror does not end there. Unchecked technical debt can cause scalability issues. These short-sighted compromises can lead to architectural negligence, causing performance bottlenecks and system crashes as user demand escalates. Furthermore, basic maintenance can transform into a terrifying endeavor.

When a client requests alterations or updates months after the software’s initial development, you confront a labyrinth of convoluted logic, undocumented hacks, and dependencies so intertwined that they boggle the mind. This is one of the instances where you might need to hire an expert software developer to tackle these complexities.

Technical Debt and AI

AI Assistants, seemingly our saviors in this rapidly changing world, come with their own set of issues. They are trained with information up until 2021. So, if a bug was fixed in a library in 2022, the AI could potentially reintroduce that bug into your code. The AI, locked in a bygone era, introduces significant technical debt into every project. This, combined with the existing human-generated technical debt, can snowball into an enormous problem. In most cases, the resulting code is either neglected or patched with even more flawed code.

My experience is a clear example of the weird middle ground that ChatGPT and similar solutions like Copilot occupy. On one hand, they are invaluable, increasing developer’s productivity by up to 40%. That’s something that would take years of hard work and study to achieve on your own.

But at the same time, your teacher hasn’t been keeping up with modern trends, and considering that retraining a big LLM could cost as much as 100 million dollars without taking into account the gathering and cleaning of new data—well, let’s just say that people aren’t overjoyed with the prospect of creating a new model so that we can ask it questions about Deno.

Adding to the potential technical debt, modern applications are more distributed than before. Data is growing exponentially, and cybersecurity continues to pose challenges. IT management isn’t getting any simpler. Therefore, it’s essential to devise new methods of building apps that optimize AI support.

The Main Risks of Technical Debt

Imagine you’re dealing with old code, and it doesn’t matter if it’s your handiwork or your AI assistant’s. Each piece of that code is like adding another rock to your backpack. Over time, that backpack’s going to weigh you down, and you’re going to move a lot slower. It’s like slapping more and more duct tape on a cracked window—eventually, you can’t even see the window under all that tape. So, let’s dive deeper:

  1. A World of Maintenance Pain: Fixing old, tangled code is like trying to patch a leaky roof on a house made of cards. And the tech world isn’t slowing down for anyone. Every day there’s a new library, a new framework, or a new tool that doesn’t play nice with our outdated stuff. It’s like trying to fit a square peg in a round hole, and all that extra effort adds up. More time, more money, and more stress, just to keep things running as they should.
  2. The Race Against Time: In the tech world, the pace is lightning-fast. If you’re not moving forward, you’re falling behind. But if we’re bogged down by old, crusty code, it’s like trying to run a marathon with an anchor tied to your ankle. Instead of exploring the latest tech, adding cool new features, or innovating, we’re stuck playing catch-up with our competitors.
  3. The Price of Dissatisfied Users and a Hit to Our Street Cred: If our outdated code leads to constant bugs, crashes, or a performance slower than a tortoise on tranquilizers, we’re not making anyone happy. Imagine promising your friend a gourmet meal, and then handing them lukewarm coffee and a stale donut. Yeah, not great. Users nowadays want things to work well, work fast, and be super easy to use. If we can’t deliver that, we’re going to lose their trust. And winning back that trust? Well, it’s about as easy as catching a greased pig. Not to mention a bad rep can spread faster than a funny cat video, potentially scaring off any new users.

So, there you have it. Technical debt can be a real party pooper if we let it get out of hand. It’s essential we keep an eye on it and tackle it head-on, so we can keep doing what we do best.

A Quick Guide to Programming with ChatGPT

Here is something that you can share with people in your office:

ChatGPT, developed by OpenAI, is an advanced conversational AI model that can help software developers in numerous ways. It can provide code snippets, offer ideas to solve coding problems, help learn new programming languages, explain complex technical concepts, and even conduct code reviews. However, the use of AI, like ChatGPT in software development, can sometimes lead to an increase in technical debt if not used properly. Therefore, a balanced approach that leverages AI’s power while maintaining code quality and integrity is essential.

How to Use ChatGPT in Software Development

  1. As a Coding Assistant: ChatGPT can assist developers in writing code by providing code snippets, correcting syntax errors, and suggesting efficient algorithms. Simply ask ChatGPT for help with a specific coding task, and it will respond with relevant, executable code snippets. However, remember to thoroughly review the suggested code to ensure that it aligns with your project’s specific requirements.
  2. As a Learning Aid: ChatGPT, demonstrating the application of AI in education, can be used as a tool to learn new programming languages or understand complex technical concepts. You can ask it to explain a specific coding concept or ask how to do a certain task in a new programming language. Its responses can often help bridge the gap in your knowledge.
  3. As a Debugging Tool: If you’re stuck on a coding issue, ChatGPT can help troubleshoot and debug problems. Simply describe your problem in detail, and it can provide insights or solutions based on its vast training data.
  4. As a Code Reviewer: ChatGPT can help review your code. It can provide feedback on code structure, adherence to coding standards, and potential performance improvements.

Avoiding Technical Debt When Using ChatGPT

While ChatGPT can be an invaluable tool, it’s essential to use it wisely to avoid accruing technical debt. Technical debt refers to the future cost of refactoring and correcting hastily-written, problematic code. Here are some strategies for avoiding technical debt while using ChatGPT:

  1. Understand the Code: While ChatGPT can provide quick solutions, it’s essential to understand the code it generates. Don’t blindly copy-paste the code; instead, take the time to comprehend its logic and flow.
  2. Check for Best Practices: Ensure that the code provided by ChatGPT adheres to coding best practices and guidelines. This includes using meaningful variable names, following appropriate indentation, and ensuring code modularity.
  3. Consider the Trade-Offs: ChatGPT may provide a solution that’s not the most optimal for your specific use case. It’s crucial to weigh the trade-offs of implementing its suggestions. Consider factors like code readability, performance, and future maintainability.
  4. Verify Compatibility: The code snippets provided by ChatGPT may not be compatible with your project’s existing codebase, libraries, or frameworks. It’s essential to verify compatibility before integrating its suggestions into your project.
  5. Ask for a Peer Review: Even though ChatGPT can help with code reviews, it doesn’t replace human judgment. Having your code reviewed by a colleague or a mentor provides a second layer of scrutiny that can catch potential issues missed by AI.
  6. Test Continuously: Implement rigorous testing practices to catch any bugs or issues in the code. Unit testing, integration testing, and system testing can help ensure that the code produced with the help of ChatGPT meets the expected requirements and doesn’t introduce new bugs.

In conclusion, ChatGPT can be a powerful tool in a developer’s toolkit, providing assistance with coding, learning, debugging, and even code reviews. However, to avoid accruing technical debt, it’s crucial to thoroughly understand and verify the AI-generated code, adhere to best practices, consider the trade-offs, ensure compatibility, and seek peer reviews.

Tutorials like the above excerpt are key to developing a responsible AI culture in your office. We can’t deny the many benefits of using ChatGPT as an assistant, but we also have to develop new practices that align with its strengths and shortcomings. And while this is specific to ChatGPT, it can easily be adapted to Amazon’s code solution, or Github’s Copilot.

Keeping the Balance

In conclusion, leveraging AI like ChatGPT for coding assistance comes with a double-edged sword, including the problems with AI. On one side, AI aids in automating mundane tasks, expediting problem-solving, and boosting overall productivity. ChatGPT can aid in writing and reviewing code, learning new programming languages, debugging issues, and even elucidating intricate technical concepts.

However, on the other side lies the shadow of technical debt, a result of outdated or poorly structured code that can hinder long-term software development. Owing to the information cutoff of AI models, they can inadvertently introduce outdated coding practices, bugs, and deprecated libraries into your codebase, leading to substantial technical debt. These could present in the form of indecipherable spaghetti code, scalability issues, or a convoluted labyrinth of undocumented hacks and tangled dependencies.

Now imagine this technical debt, a silent predator, coupling with AI-induced debt, further exacerbating the issue. It’s like trying to run a marathon with weights around your ankles, the forward progress continuously restrained by the burden of the past. The result is increased maintenance time, slower evolution pace, dissatisfied users, and a possible dent in your reputation.

However, a careful and balanced approach can significantly mitigate these risks. Comprehending the code rather than blind copy-pasting, adhering to best coding practices, considering trade-offs, verifying compatibility, seeking peer reviews, and implementing rigorous testing can keep technical debt in check.

Moreover, organizations must recognize the rapid evolution in the tech industry and the need to keep AI models like ChatGPT updated to avoid fostering a mass of technical debt. Recent developments suggest potential solutions on the horizon, including continual learning for AI models, which allows them to learn and adapt to new data after initial training. Another solution could be the use of transformer models with an emphasis on lifelong learning, enabling the AI to stay up-to-date with modern programming paradigms.

We must remember that AI, in its current form, is not a silver bullet. It’s a tool, an assistant, a means to augment human abilities and not to replace them. As we stride further into the era of AI-assisted coding, we must nurture a responsible AI culture in our workspaces, one that capitalizes on the strengths of these systems while conscientiously mitigating their shortcomings.

The future of AI-assisted coding, then, is not just in the hands of AI researchers and data scientists. It is also in the hands of every developer who uses these tools, who must be diligent and careful to ensure the code they produce with AI is of high quality, maintainable, and future-proofed against rapid changes in the industry. By doing so, we can truly harness the power of AI while avoiding the pitfalls of technical debt.

If you enjoyed this article, check out one of our other AI articles.

Rocío Belfiore

By Rocío Belfiore

Chief Research and Development Officer Rocio Belfiore manages teams of specialists and heads all internal software development, from big data projects to business intelligence algorithms. Her department's cooperation and conviction contributes to BairesDev's continual growth.

Stay up to dateBusiness, technology, and innovation insights.Written by experts. Delivered weekly.

Related articles

Software Development - The Power of
Software Development

By BairesDev Editorial Team

18 min read

Contact BairesDev
By continuing to use this site, you agree to our cookie policy and privacy policy.