How to Learn a Programming Language Using AI?

Whether you’re new to software development or have decades of experience, there’s always something new to learn. The TIOBE Index tracks the top 50 most popular programming languages, offering numerous opportunities for career advancement. Given the breadth of technologies available, finding the time to learn a new skill and doing it effectively can be challenging.

Recently, I have been learning Rust, a type-safe language built with performance, reliability, and productivity in mind. Here are a few techniques for using AI coding assistants to improve your learning experience.

By the end of this post, you should have several new AI-based skills to apply during your learning journey and accelerate towards your goals. When I refer to AI, I mean AI-powered coding assistants based on large language models, such as Amazon Q Developer (formerly CodeWhisperer), GitHub Copilot, and JetBrains AI Assistant. The tips below can be applied to the tool of your choice.

Be Suspicious of Parametric Knowledge

programming language using AI

“Parametric knowledge” is information stored within the model during training. This encoded data is why AI can often respond quickly with accurate information. However, AI can sometimes get the answer spectacularly wrong.

While these systems can be helpful, they have limits constrained by the time and resources required to collect data and train the model. For instance, OpenAI’s ChatGPT 4 Turbo model is trained on information up to December 2023. From a user’s perspective, there’s uncertainty about whether “complete” knowledge exists within any particular model.

Being mindful of the cutoff date for the data set can help you better understand and process the responses from your AI chat sessions. Researching a provider’s data-gathering practices and training process can lead to a more satisfying experience.

While AI can be helpful, verified human sources of knowledge remain the most valuable during any learning process. AI systems are trained to be helpful above all else, sometimes hallucinating ideas and concepts that may not exist. It takes “real intelligence” to understand when AI makes mistakes.

More Articles:

Read Code and Prompt for Explanation

The open-source software movement has provided every learning programmer with easy access to production code. Open-source code bases offer an excellent opportunity to see how professionals write and pick up language idioms and tricks. But reading an unfamiliar language can be daunting without a frame of reference.

programming language using AI
programming language using AI

A technique I’ve been using is finding code on GitHub for particular languages and pasting it into an AI chat session with the prompts, “Please explain this code,” and “please list the important language concepts happening within this code block.”

Here’s a template for this prompt:


Please explain the following code:

// rust code goes here

Also, list the important language concepts from the description in a bulleted list so I may do more research.


The resulting list of topics is an excellent way to focus my learning on what is essential rather than trying to absorb an entire library’s worth of information at once.
### Prompt for Verbose Inline Comments

A wall of code can be intimidating when you haven’t fully learned the syntax or semantics of a language. Using the prompt “comment each line” is a quick way to get a general idea of what an application may be doing.

With JetBrains AI Assistant, you can get a Diff view of the changes in a side-by-side or unified view, allowing you to quickly review the changes and choose to accept or reject them.

### Play with Different Options

Learning involves experimenting and playing with learned concepts. With AI, trying out variant implementations has never been more straightforward.

Here’s a prompt I’ve used to discover features in the Rust language:

Given the following API, show me three different implementations:

fn add(x: i32, y: i32) -> i32 {
// implementation goes here


Remember, this is about learning, so the APIs don’t have to be particularly sophisticated. Playing with ideas allows you to uncover different learning paths outside the AI chat session.

### More Context is Always Better

LLMs have information limitations. You can provide additional context to improve the results. Instead of snappy keyword-based questions, use example-based prompting for better predictions.

Here’s a template prompt:

Given the following three examples, what would an implementation for <X> look like?

example 1:

example 2:


example 3:

The more examples you provide, the better the results. Amazon Q Developer offers natural follow-up questions to keep you engaged in the learning process.

### Peek at Code Completion

Most AI services offer multiline code completion. Instead of accepting all options presented, create a code comment indicating your goal. For instance:

// TODO: create a match expression to process the different message variants

Before accepting code completions, ensure you understand the code. Accepting code you don’t fully comprehend can impede your learning progress.

Explain Errors and Find Solutions

Compilation and runtime errors can be cryptic. Use an AI assistant to explain the issue, find where it occurs, and propose a solution. Here’s an example prompt:

What exactly is the problem here in my Rust backtrace? Reduce the response to the file and line, explain the error, and propose a solution.

Share Ideas

Recontextualize your newly found knowledge with others. Sharing your code samples and ideas on social media platforms can provide valuable feedback.

Summarize the Chat

At the end of a learning session, ask your AI chat session to summarize all your questions and list a single-sentence answer for each. This summary serves as a quick reference guide for your next session and makes a great blog post.

Learn Faster with AI

These tips should help you use AI tools to learn faster and more effectively. These tools enable you to achieve your goals, form new thoughts, and explore new ideas. They also help you connect with communities of other learners.

If you have any other tips for accelerating your learning using AI, please share them with me and others.

Stay tuned to our website Gripe Web for more updates.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top