How Would I Learn to Code with ChatGPT if I Had to Start Again?

Exploring ChatGPT in my 15 years coding learning journey — Moving beyond copy-pasting

Livia Ellen
Towards Data Science

--

Photo by Arnold Francisca on Unsplash

Coding has been a part of my life since I was 10. From modifying HTML & CSS for my Friendster profile during the simple internet days to exploring SQL injections for the thrill, building a three-legged robot for fun, and lately diving into Python coding, my coding journey has been diverse and fun!

Here’s what I’ve learned from various programming approaches.

The way I learn coding is always similar; As people say, mostly it’s just copy-pasting. 😅

When it comes to building something in the coding world, here’s a breakdown of my method:

  1. Choose the Right Framework or Library
  2. Learn from Past Projects
  3. Break It Down into Steps
    Slice your project into actionable item steps, making development less overwhelming.
  4. Google Each Chunk
    For every step, consult Google/Bing/DuckDuckGo/any search engine you prefer for insights, guidance, and potential solutions.
  5. Start Coding
    Try to implement each step systematically.

However, even the most well-thought-out code can encounter bugs. Here’s my strategy for troubleshooting:

1. Check Framework Documentation: ALWAYS read the docs!

2. Google and Stack Overflow Search: search on Google and Stack Overflow. Example keyword would be:

site:stackoverflow.com [coding language] [library] error [error message]

site:stackoverflow.com python error ImportError: pandas module not found

- Stack Overflow Solutions: If the issue is already on Stack Overflow, I look for the most upvoted comments and solutions, often finding a quick and reliable answer.
- Trust My Intuition: When Stack Overflow doesn’t have the answer, I trust my intuition to search for trustworthy sources on Google; GeeksForGeeks, Kaggle, W3School, and Towards Data Science for DS stuff ;)

3. Copy-Paste the Code Solution

4. Verify and Test: The final step includes checking the modified code thoroughly and testing it to ensure it runs as intended.

And Voila you just solve the bug!

Photo by Stephen Hocking on Unsplash

Isn’t it beautiful?

But in reality, are we still doing this?!

Lately, I’ve noticed a shift in how new coders are tackling coding. I’ve been teaching how to code professionally for about three years now, bouncing around in coding boot camps and guest lecturing at universities and corporate training. The way coders are getting into code learning has changed a bit.

I usually tell the fresh faces to stick with the old-school method of browsing and googling for answers, but people are still using ChatGPT eventually. And their alibi is

“Having ChatGPT (for coding) is like having an extra study buddy -who chats with you like a regular person”.

It comes in handy, especially when you’re still trying to wrap your head around things from search results and documentation — to develop what is so-called programmer intuition.

Now, don’t get me wrong, I’m all for the basics. Browsing, reading docs, and throwing questions into the community pot — those are solid moves, in my book. Relying solely on ChatGPT might be a bit much. Sure, it can whip up a speedy summary of answers, but the traditional browsing methods give you the freedom to pick and choose, to experiment a bit, which is pretty crucial in the coding world.

But, I’ve gotta give credit where it’s due — ChatGPT is lightning-fast at giving out answers, especially when you’re still trying to figure out the right from the wrong in search results and docs.

I realize this shift of using ChatGPT as a study buddy is not only happening in the coding scene, Chatgpt has revolutionized the way people learn, I even use ChatGPT to fix my grammar for this post, sorry Grammarly.

Saying no to ChatGPT is like saying no to search engines in the early 2000 era. While ChatGPT may come with biases and hallucinations, similar to search engines having unreliable information or hoaxes. When ChatGPT is used appropriately, it can expedite the learning process.

Now, let’s imagine a real-life scenario where ChatGPT could help you by being your coding buddy to help with debugging.

Scenario: Debugging a Python Script

Imagine you’re working on a Python script for a project, and you encounter an unexpected error that you can’t solve.

Here is how I used to be taught to do it — the era before ChatGPT.

Browsing Approach:

  1. Check the Documentation:

Start by checking the Python documentation for the module or function causing the error.

For example:
- visit https://scikit-learn.org/stable/modules/ for Scikit Learn Doc

2. Search on Google & Stack Overflow:

If the documentation doesn’t provide a solution, you turn to Google and Stack Overflow. Scan through various forum threads and discussions to find a similar issue and its resolution.

StackOverflow Thread

3. Trust Your Intuition:

If the issue is unique or not well-documented, trust your intuition! You might explore articles and sources on Google that you’ve found trustworthy in the past, and try to adapt similar solutions to your problem.

Google Search Result

You can see that on the search result above, the results are from W3school - (trusted coding tutorial site, great for cheatsheet) and the other 2 results are official Pandas documentation. You can see that search engines do suggest users look at the official documentation. ;)

And this is how you can use ChatGPT to help you debug an issue.

New Approach with ChatGPT:

  1. Engage ChatGPT in Conversations:

Instead of only navigating through documentation and forums, you can engage ChatGPT in a conversation. Provide a concise description of the error and ask. For example,

“I’m encountering an issue in my [programming language] script where [describe the error]. Can you help me understand what might be causing this and suggest a possible solution?”

Engage ChatGPT in Conversations

2. Clarify Concepts with ChatGPT:

If the error is related to a concept you are struggling to grasp, you can ask ChatGPT to explain that concept. For example,

“Explain how [specific concept] works in [programming language]? I think it might be related to the error I’m facing. The error is: [the error]”

Clarify Concepts with ChatGPT

3. Seek Recommendations for Troubleshooting:

You ask ChatGPT for general tips on troubleshooting Python scripts. For instance,

“What are some common strategies for dealing with [issue]? Any recommendations on tools or techniques?”

Using ChatGPT as coding buddy

Potential Advantages:

  • Personalized Guidance: ChatGPT can provide personalized guidance based on the specific details you provide about the error and your understanding of the problem.
  • Concept Clarification: You can seek explanations and clarifications on concepts directly from ChatGPT leveraging their LLM capability.
  • Efficient Troubleshooting: ChatGPT might offer concise and relevant tips for troubleshooting, potentially streamlining the debugging process.

Possible Limitations:

Now let’s talk about the cons of relying on ChatGPT 100%. I saw these issues a lot in my student's journey on using ChatGPT. Post ChatGPT era, my students just copied and pasted the 1-line error message from their Command Line Interface despite the error being 100 lines and linked to some modules and dependencies. Asking ChatGPT to explain the workaround by providing a 1 line error code might work sometimes, or worse — it might add 1–2 hour manhour of debugging.

ChatGPT comes with a limitation of not being able to see the context of your code. For sure, you can always give a context of your code. On a more complex code, you might not be able to give every line of code to ChatGPT. The fact that Chat GPT only sees the small portion of your code, ChatGPT will either assume the rest of the code based on its knowledge base or hallucinate.

These are the possible limitations of using ChatGPT:

  • Lack of Real-Time Dynamic Interaction: While ChatGPT provides valuable insights, it lacks the real-time interaction and dynamic back-and-forth that forums or discussion threads might offer. On StackOverflow, you might have 10 different people who would suggest 3 different solutions which you can compare either by DIY ( do it yourself — try it out) or see the number of upvotes.
  • Dependence on Past Knowledge: The quality of ChatGPT’s response depends on the information it has been trained on, and it may not be aware of the latest framework updates or specific details of your project.
  • Might add extra Debugging Time: ChatGPT does not have a context of your full code, so it might lead you to more debugging time.
  • Limited Understanding of Concept: The traditional browsing methods give you the freedom to pick and choose, to experiment a bit, which is pretty crucial in the coding world. If you know how to handpick the right source, you probably learn more from browsing on your own than relying on the ChatGPT general model.
    Unless you ask a language model that is trained and specialized in coding and tech concepts— research papers on coding materials, or famous deep learning lectures from Andrew Ng, Yann Le Cunn’s tweet on X (formerly Twitter), pretty much ChatGPT would just give a general answer.

This scenario showcases how ChatGPT can be a valuable tool in your coding toolkit, especially for obtaining personalized guidance and clarifying concepts. Remember to balance ChatGPT’s assistance with the methods of browsing and ask the community, keeping in mind its strengths and limitations.

Final Thoughts

Things I would recommend for a coder

If you really want to leverage the autocompletion model; instead of solely using ChatGPT, try using VScode extensions for auto code-completion tasks such as CodeGPT — GPT4 extension on VScode, GitHub Copilot, or Google Colab Autocomplete AI tools in Google Colab.

Auto code completion on Google Colab

As you can see in the screenshot above, Google Colab automatically gives the user suggestions on what code comes next.

Another alternative is Github Copilot. With GitHub Copilot, you can get an AI-based suggestion in real-time. GitHub Copilot suggests code completions as developers type and turn prompts into coding suggestions based on the project’s context and style conventions. As per this release from Github, Copilot Chat is now powered by OpenAI GPT-4 (a similiar model that ChatGPT is using).

Github Copilot Example — image by Github

I have been actively using CodeGPT as a VSCode Extension before I knew that Github Copilot is accessible for free if you are in education program. CodeGPT Co has 1M download to this date on the VSCode Extension Marketplace. CodeGPT allows seamless integration with the ChatGPT API, Google PaLM 2, and Meta Llama.
You can get code suggestions through comments, here is how:

  • Write a comment asking for a specific code
  • Press cmd + shift + i
  • Use the code 😎

You can also initiate a chat via the extension in the menu and dive into coding conversations 💬

As I reflect on my coding journey, the invaluable lesson learned is that there’s no one-size-fits-all approach to learning. It’s essential to embrace a diverse array of learning methods, seamlessly blending traditional practices like browsing and community interaction with the innovative capabilities of tools like ChatGPT and auto code-completion tools.

What to Do:

  • Utilize Tailored Learning Resources: Make the most of ChatGPT’s recommendations for learning materials.
  • Collaborate for Problem-Solving: Utilize ChatGPT as a collaborative partner as if you are coding with your friends.

What Not to Do:

  • Over-Dependence on ChatGPT: Avoid relying solely on ChatGPT and ensure a balanced approach to foster independent problem-solving skills.
  • Neglect Real-Time Interaction with Coding Community: While ChatGPT offers valuable insights, don’t neglect the benefits of real-time interaction and feedback from coding communities. That also helps build a reputation in the community
  • Disregard Practical Coding Practice: Balance ChatGPT guidance with hands-on coding practice to reinforce theoretical knowledge with practical application.

Let me know in the comments how you use ChatGPT to help you code!
Happy coding!
Ellen

Let’s Connect

  • 🌐 Follow me on LinkedIn and Medium
  • 📬 Subscribe for free to my Medium newsletter for email updates!
  • 🚀 Please clap, save into your reading list, share, and comment on this article if you found this useful!
  • 👏 Oh Hey! you can clap more than one (50 max)in 1 article — that will help me get a cup of coffee to write my upcoming articles with ;)
  • ☕ or just buy me a real coffee ❤ — Yes I love coffee.

--

--

Data Scientist, Machine Learning and Augmented Reality, simplifying complex codes. Teach DS & AI @ Le Wagon 🪂 Paraglider https://www.linkedin.com/in/liviaellen