+++ title = 'When to Use AI While Programming (And When Not To)' date = 2024-09-24T14:50:04+02:00 draft = false tags = ['AI', 'Programming', 'Software Development', 'Best Practices', 'Coding', 'Artificial Intelligence', 'Development'] +++ ## Preface As I was working on a project in Golang, a language I've been learning for a few weeks, I realized the importance of balancing AI assistance with hands-on learning. I had been relying too heavily on Copilot, and it ultimately led to frustration and burnout. This experience made me think about the situations in which AI should be used—and avoided—while programming. ## When You Want to Learn Something New It's common sense, but worth repeating: if you want to learn a new skill or technology, don't rely on AI for repetitive tasks. Doing so can hinder your progress and prevent you from becoming proficient. Can you truly say you're fluent in a programming language if you've completed a large project without knowing how to perform basic tasks like reading a file? ## When You're Uncertain About the Basics Many of us, including myself, turn to AI when we're unsure about a particular concept or technology. However, this approach can be counterproductive. To work efficiently, we need to have a solid grasp of the underlying concepts. Instead of relying on AI, it's better to take the time to read the documentation and understand the fundamentals. ## Working with New Technologies and Libraries Most AI models are trained on relatively old data, which can lead to outdated suggestions. This is particularly problematic when working with new technologies or libraries that are constantly evolving. AI may suggest code that's no longer recommended or has been deprecated. ## Writing Sensible Programs When working with sensible code, it's generally not a good idea to let AI write code for you. For example, if you need to implement cryptography, you should do it yourself after learning how it works and the best practices to follow. Neglecting this can lead to insecure systems. ## A Balanced Approach I'm not advocating for a complete ban on AI usage. In fact, I use it daily, and it's been a game-changer for repetitive tasks where I'm confident in my ability to spot logical errors. However, if you find yourself in one of the situations mentioned above, take a step back and invest time in learning the documentation or seeking out alternative resources. Failing to do so can lead to a lack of motivation and a plethora of hidden bugs in your code.