Bridging the AI Learning Gap – O’Reilly


When I started working on the new edition of Head First C# back in 2023, AI tools like ChatGPT and Copilot were already changing how developers write and learn code. It was clear that I needed to cover them. But that raised an interesting challenge: How do you teach new and intermediate developers to use AI effectively?

Almost all of the material that I found was aimed at senior developers—people who can recognize patterns in code, spot the subtle errors often found in AI-generated code, and refine and refactor AI output. But the audience for the book—a developer learning C# as their first, second, or third language—doesn’t yet have these skills. It became increasingly clear that they would need a new strategy.


Learn faster. Dig deeper. See farther.

Designing an effective AI learning path that worked with the Head First method—which engages readers through active learning and interactive puzzles, exercises, and other elements—took months of intense research and experimentation. The result was Sens-AI, a new series of hands-on elements that I designed to teach developers how to learn with AI, not just generate code. The name is a play on “sensei,” reflecting the role of AI as a teacher or instructor rather than just a tool.

The key realization was that there’s a big difference between using AI as a code generation tool and using it as a learning tool. That distinction is a critical part of the learning path, and it took time to fully understand. Sens-AI guides learners through a series of incremental learning elements that get them working with AI immediately, creating a satisfying experience from the start while they progressively learn the prompting skills they’ll lean on as their development skills grow.

The Challenge of Building an AI Learning Path That Works

I developed Sens-AI for the fifth edition of Head First C#. After more than two decades of writing and teaching for O’Reilly, I’ve learned a lot about how new and intermediate developers learn—and just as importantly, what trips them up. In some ways AI-assisted coding is just another skill to learn, but it comes with its own challenges that make it uniquely difficult for new and intermediate learners to pick up. My goal was to find a way to integrate AI into the learning path without letting it short-circuit the learning process.

Step 1: Show Learners Why They Can’t Just Trust AI

One of the biggest challenges for new and intermediate developers trying to integrate AI into their learning is that an overreliance on AI-generated code can actually prevent them from learning. Coding is a skill, and like all skills it takes practice, which is why Head First C# has dozens of hands-on coding exercises designed to teach specific concepts and techniques. A learner who uses AI to do the exercises will struggle to build those skills.

The key to using AI safely is trust but verify—AI-generated explanations and code may look correct, but they often contain subtle mistakes. Learning to spot these errors is critical for using AI effectively, and developing that skill is an important stepping stone on the path to becoming a senior developer. The first step in Sens-AI was to make this lesson clear immediately. I designed an early Sens-AI exercise to demonstrate how AI can be confidently wrong.

Here’s how it works:

  • Early in the book, learners complete a pencil-and-paper exercise where they analyze a simple loop and determine how many times it executes.
  • Most readers get the correct answer, but when they feed the same question into an AI chatbot, the AI almost never gets it right.
  • The AI typically explains the logic of the loop well—but its final answer is almost always wrong, because LLM-based AIs don’t execute code.
  • This reinforces an important lesson: AI can be wrong—and sometimes, you are better at solving problems than AI. By seeing AI make a mistake on a problem they already solved correctly, learners immediately understand that they can’t just assume AI is right.

Step 2: Show Learners That AI Still Requires Effort

The next challenge was teaching learners to see AI as a tool, not a crutch. AI can solve almost all of the exercises in the book, but a reader who lets AI do that won’t actually learn the skills they came to the book to learn.

This led to an important realization: Writing a coding exercise for a person is exactly the same as writing a prompt for an AI.

In fact, I realized that I could test my exercises by pasting them verbatim into an AI. If the AI was able to generate a correct solution, that meant my exercise contained all the information a human learner needed to solve it too.

This turned into another key Sens-AI exercise:

  • Learners complete a full-page coding exercise by following step-by-step instructions.
  • After solving it themselves, they paste the entire exercise into an AI chatbot to see how it solves the same problem.
  • The AI almost always generates the correct answer, and it often generates exactly the same solution they wrote.

This reinforces another critical lesson: Telling an AI what to do is just as difficult as telling a person what to do. Many new developers assume that prompt engineering is just writing a quick instruction—but Sens-AI demonstrates that a good AI prompt is as detailed and structured as a coding exercise. This gives learners an immediate hands-on experience with AI while teaching them that writing effective prompts requires real effort.

By first having the learner see that AIs can make mistakes, and then having them generate code for a problem they solved and compare it to their own solution—and even use the AI’s code source of ideas for refactoring—they gain a deeper understanding of how to engage with AI critically. These two opening Sens-AI elements laid the groundwork for a successful AI learning path.

The Sens-AI Approach—Making AI a Learning Tool

The final challenge in developing the Sens-AI approach was finding a way to help learners develop a habit of engaging with AI in a positive way. Solving that problem required me to develop a series of practical exercises, each of which gives the learner a specific tool that they can use immediately but also reinforces a positive lesson about how to use AI effectively.

One of AI’s most powerful features for developers is its ability to explain code. I built the next Sens-AI element around this by having learners ask AI to add comments to code they just wrote. Since they already understand their own code, they can evaluate the AI’s comments—checking whether the AI understood their logic, spotting where it went wrong, and identifying gaps in its explanations. This provides hands-on training in prompting AI while reinforcing a key lesson: AI doesn’t always get it right, and reviewing its output critically is essential.

The next step in the Sens-AI learning path focuses on using AI as a research tool, helping learners explore C# topics effectively through prompt engineering techniques. Learners experiment with different AI personas and response styles—casual versus precise explanations, bullet points versus long answers—to see what works best for them. They’re also encouraged to ask follow-up questions, request reworded explanations, and ask for concrete examples that they can use to refine their understanding. To put this into practice, learners research a new C# topic that wasn’t covered earlier in the book. This reinforces the idea that AI is a useful research tool, but only if you guide it effectively.

Sens-AI focuses on understanding code first, generating code second. That’s why the learning path only returns to AI-generated code after reinforcing good AI habits. Even then, I had to carefully design exercises to ensure AI was an aid to learning, not a replacement for it. After experimenting with different approaches, I found that generating unit tests was an effective next step.

Unit tests work well because their logic is simple and easy to verify, making them a safe way to practice AI-assisted coding. More importantly, writing a good prompt for a unit test forces the learner to describe the code they’re testing—including its behavior, arguments, and return type. This naturally builds strong prompting skills and positive AI habits, encouraging developers to think carefully about their design before asking AI to generate anything.

Learning with AI, Not Just Using It

AI is a powerful tool for developers, but using it effectively requires more than just knowing how to generate code. The biggest mistake new developers can make with AI is using it as a crutch for generating code, because that keeps them from learning the coding skills they need to critically evaluate all of the code that AI generates. By giving learners a step-by-step approach that reinforces safe use of AI and great AI habits, and reinforcing it with examples and practice, Sens-AI gives new and intermediate learners an effective AI learning path that works for them.

AI-assisted coding isn’t about shortcuts. It’s about learning how to think critically, and about using AI as a positive tool to help us build and learn. Developers who engage critically with AI, refine their prompts, question AI-generated output, and develop effective AI learning habits will be the ones who benefit the most. By helping developers include AI as a part of their skillset from the start, Sens-AI ensures that they don’t just use AI to generate code—they learn how to think, problem-solve, and improve as developers in the process.


On April 24, O’Reilly Media will be hosting Coding with AI: The End of Software Development as We Know It—a live virtual tech conference spotlighting how AI is already supercharging developers, boosting productivity, and providing real value to their organizations. If you’re in the trenches building tomorrow’s development practices today and interested in speaking at the event, we’d love to hear from you by March 5. You can find more information and our call for presentations here.





Source link