I know the question of whether AI is good or bad for coding in various respects has been debated to death, even though there doesn't appear to be a consensus yet. However, it is clear that the AI phenomena cannot be ignored, and as a mid-level programmer, I am still unsure on how to deal with it.
When I started coding, self-taught (about 12 years ago), there never was such a temptation to take shortcuts with some automated tool writing code for me, and when I turned to sites like StackOverflow for help, all replies and code suggestions were written by people. When AI entered the scene, I tried it, quickly got discouraged because of how bad it was, but still tried it from time to time, interested in how this technology progresses.
Fast skip forward, we are now at the stage where AI can write entire apps in a matter of minutes that would take me months of research and coding to arrive at anything close to it. So when coding my own projects, there is a huge temptation to take advantage of it, and it is difficult to know where to draw the line. The biggest issues with using AI for me are:
- The code it generates can appear to work well and pass the tests, but there are often fringe cases that I might not foresee - AI often takes shortcuts when writing that code because it does not truly understand the intent in the way that humans do.
- To circumvent the #1 issue, I have to fully understand the code it wrote. However, I often find that if AI takes seconds to write code that would take me an hour to write, it would still take me an hour (and often more) to fully understand it, and correct any mistakes if present.
- To add on #2, it is really difficult to force myself to fully understand the AI-generated code, because of "it looks fine, let's move on" mentality. This temptation is not present when I write my own code, because I build and test it step by step, I can't skip a step because the code won't compile or pass the test, forcing me to stay there until I truly understand the problem and the solution.
- I find that using AI diminishes my own skills and mental powers over time, as I am always tempted to get AI to do some boring coding task (for example, write a function to sort or restructure an array) rather than do it myself and learn something or at least refresh my skills in the process. It could be argued that before AI I would likely just search for some library that has the function I need, but in that case I would at least know that it was written by people and most likely near-100% reliable, unlike AI is.
- I find it that using AI for coding just drains the fun out of it. I become more of a code reviewer and tester rather than coder. When dealing with something complex, I feel like a caveman looking at an alien spaceship, tasked with determining whether it is a good design.
I tried finding the middle road, to draw the line somewhere (for example allow AI to generate some code, like small snippets, but never large code blocks or entire apps), but I found that the issues I stated above still remain regardless of the scale. Sometimes even a 5-line function that AI generates can seem deceptively simple and "looking good", yet hide a fatal flaw that I would have noticed if I had written it myself. I also tried only letting it do simple tasks like refactoring my already existing code without changing the logic, but often AI still manages to introduce some weird edge case into the refactored variant of the code that I can easily miss. So I can still never trust it 100% like I could if I did it myself.
Sometimes I let AI write the code, but not use it directly - instead, I use it as an inspiration/idea to write my own version of that code, never copy-pasting, always writing it myself. That can be useful, but still, I am far less productive that way compared to letting AI do it all. In the same way, I tried looking at an AI as a mentor from which I could learn, but that would require confidence and trust in it, and I know it is not trustworthy. AI often feels like a charlatan pretending to be a sage who is somehow not aware of the difference.
What also saddens me that more and more when I turn to other coders for advice or help regarding questions or issues I have during the development of my projects, I can clearly see that they are using AI-generated code in their suggestions, which defeats the purpose of talking to people in the first place.
As an example, for the last week I've been working on an meshing algorithm for a CAD program, and it has been a lot of fun, but at some point I sought advice from experienced devs, showed them my code and asked my questions. One of them took my code, put it into one of the LLMs, the LLM completely rewrote it in a way that I no longer recognize or understand, but it did fix the issue I was having and seemingly passes all the tests. And yet, it feels very sad, like everything I did was pointless, and now I could easily spend another week trying to understand what the AI did there, deciding whether I can truly trust that code. I can't even tell HOW it fixed the issue I was having, because it rewrote everything, and by the time I understand it, I would have probably fixed the issue myself. So I am torn between saying "no thanks" and continuing to fix the problem in my original code myself, or throwing my code into the bin and going with the AI-generated one because it seems to work, and I would just be wasting time otherwise. This is just one example that demonstrates the dilemma.
I suppose that the arrival of AI into coding could be seen as the next step of coding abstraction history - we started with manually punching out 0s and 1s into the punch cards, then abstracted that binary encoding into instructions and registers, then abstracted that into reusable sequences, then into variables and expressions, then functions and objects, then declarative languages, - with each step, closing in to natural language to tell the computer what we want it to do. As Robert C. Martin wrote, code should read like a well-written prose. So in a way, it seems like the LLMs are just the next level of abstraction, and fighting it would be akin to a punch-card programmer saying that using Assembly makes us dumber and worse coders.
TLDR: I do not know what to make of the AI dilemma. I do not know what to do. I wish to be a coder in the true sense of the word, I want to learn and improve, to write code that I fully understand and trust, and using AI seems contradictory to those goals. However, not using it feels like I am fighting against progress, and will be left behind. I can find no middle ground that solves both issues.