
Hannah Hackney knew just enough about coding for artificial intelligence to be a useful teacher.Credit: MTStock Studio/Getty
In the lab at McGill University in Montreal, Canada, where I am a PhD student, my colleagues and I study the optical and electronic properties of organic molecules. Most of this work is based on chemical synthesis, but we complement it with the occasional use of software to predict and rationalize molecules’ properties.
Recently, I wanted to understand how a specific reaction mechanism could explain why some molecules are much more stable than others that seem very similar. As I took on this project, I realized that my computational skills were not up to the task: I would need to learn to code so I could manage and process the large volumes of data that I was rapidly producing.
Fortunately, high-quality educational resources have never been more plentiful or accessible. I had already casually tried coding in my free time, relying mostly on free apps, YouTube videos and books. A colleague suggested that I try using artificial intelligence (AI) instead. I was amazed at how useful I found the free tools based on large language models (LLMs), such as ChatGPT and Claude, for self-teaching, and how dramatically they accelerated my learning.
I had experimented with ChatGPT before, but this was the first time I found it valuable enough to use in my work and daily life. The results of various other tasks hadn’t been sophisticated enough to be useful. For example, when I asked for ideas for reactions that I could try out to synthesize target molecules, it provided methods that I found either obvious or mistaken. When I fed it point-by-point notes to translate into the first draft of a document, I had to edit the prose too much to feel that it had really saved me effort.
The margins of existing knowledge
I think the reason I find LLMs useful for coding, but unhelpful for many other tasks, is that there’s a sweet spot where the information that they produce is most likely to be useful for learning. I’ve spent years doing chemical synthesis on complex systems, so I’m an expert in the field, and understand the subtleties better than AI might (at least for now). As a result, I was disappointed when consulting AI for insight into difficult reactions.
For coding, self-teaching with AI works well for me because it’s much closer to the margins of my existing knowledge and experience. The idea that we learn best when we fit new concepts into what we already know is well established in theories of education. The early-twentieth-century Russian psychologist Lev Vygotsky wrote about the “zone of proximal development”, a sweet spot where the learner can enjoy the guidance of a “more knowledgeable other”.
I was already aware of the basic concepts and syntax of coding, having completed a couple of small introductory courses. This basic knowledge provided valuable foundations, which would have been difficult to establish without direction. I could then enjoy the guidance of my ‘more knowledgeable other’.
Democratization of learning
One of the greatest benefits of AI is that it enables a style of education that is usually very resource intensive — rapid question-and-answer. In most educational settings, it’s impractical to have a teacher on hand to answer every question or produce large volumes of personalized content. But the inherently conversational mode of a tool based on an LLM means that it replicates the speed and ease of a personal tutor.
It also streamlines the process of seeking information. Even if you are learning through a course, such as a set of videos or a book, it can take a lot of time and effort to find the answers to specific questions. For example, your question might be answered in an article, but with an explanation not suited to your skill level, so you have to spend more time searching for context or definitions. Or you might post on a forum asking for help and spend hours or days waiting for an answer.
With an LLM, you can tune the tone or skill level of an explanation, or ask follow-up questions about specific terms or concepts. The short feedback time helped me to enter a flow state, which created a sense of control and kept me motivated.
AI provides the ‘scaffolding’
I was initially surprised to learn that most of the popular free LLM-based tools, such as ChatGPT, Claude and DeepSeek, can produce adequate code for simple tasks from a written input. This created a valuable opportunity to work on higher-level coding skills, including structure, design and debugging, which are not usually explored when you’re learning the basics.
Most programmers will tell you that it is not specific knowledge of syntax and functions that makes a good coder. It’s bigger-picture, higher-order critical-thinking skills. Fortunately, most scientists and researchers have already developed many relevant skills: logical and algorithmic thinking, a sense of organization and long-range order, attention to detail and anticipation of possible failures.