Blog

Learning a New Programming Language with ChatGPT

avatar

Andrej

blog

As a seasoned PHP and JavaScript programmer, I recently embarked on a journey to learn Python for a work assignment using an unconventional approach: asking ChatGPT for guidance first, rather than consulting the official documentation straight away. Reason being – we need an app live and as fast as possible. 

Before we go in depth it’s important to note that using the official documentation is highly valuable and the right place to find information about the desired topic.

Basic Concepts as Building Blocks


As the title suggests, learning a new programming language requires foundational programming knowledge of concepts like control flow, error handling, data structures, algorithms, so on and so forth, and being a web programmer you need to know how the  web works too.

At the end of the day, programming languages are just tools to get the job done. What they share are these concepts and when you understand them you can use any programming language.

Navigating Python with ChatGPT

With the essentials in place I turned to ChatGPT for python specific nuances. I didn’t even know the syntax, let alone the reserved keywords or conventions.
ChatGPT was here to help, and my approach was dead simple – asking questions on how to do stuff in Python. 

The questions varied from being extremely simple like “How do you iterate a dictionary in Python?” to something more complex like “Can you explain the Python import system and module management?” or “Can you write a unit test for this scenario?”.

As always, each time ChatGPT responded with a rich answer with more than enough information to grasp the topic at hand.

It is imperative that you always analyze the answer and not take it for granted. Every time there was something unknown in the code I made sure to ask away immediately to make sure everything was crystal clear.

This approach puts the programmer in the driver\’s seat and ChatGPT as your co-pilot. You already know what you want to accomplish and your assistant is here to help you understand how to do it in another programming language.

Caveats

While ChatGPT is a great tool, it’s not perfect. It can hallucinate and when you don’t prompt it properly you might be misled.

With some experience you can always tell that things are going south and it might be worthwhile to start a new conversation or even stop the conversation and look at the official documentation as it is the ultimate source of truth for a given topic or look up common solutions to your problems on StackOverflow which happened many times to me during this process.

Conclusion

My recent experience with ChatGPT tells me that it’s an excellent tool to learn a new programming language with.

What amazed me the most is the fact that with almost zero prior knowledge of Python, me and my team built a production ready, stable and secure application in record time and it’s now live.

With the above mentioned caveats in mind and your knowledge of the basic concepts you will be well on your way to learn a new programming language with ChatGPT

Good luck on your journey!