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

12 months ago 104

Photo by Arnold Francisca on UnsplashCoding 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...

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:

Choose the Right Framework or LibraryLearn from Past ProjectsBreak It Down into Steps
Slice your project into actionable item steps, making development less overwhelming.Google Each Chunk
For every step, consult Google/Bing/DuckDuckGo/any search engine you prefer for insights, guidance, and potential solutions.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 UnsplashIsn’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 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 as 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 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.

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.

Searching Approach:

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

New Approach with ChatGPT:

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 Python script where [describe the error]. Can you help me understand what might be causing this and suggest a possible solution?”

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,

“Can you explain how [specific concept] works in Python? I think it might be related to the error I’m facing. The error is: [the error]”

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 overfitting models? Any recommendations on tools or techniques?”

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:

Lack of Real-Time Interaction: While ChatGPT provides valuable insights, it lacks the real-time interaction and dynamic back-and-forth that forums or discussion threads might offer.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 updates or specific details of your project.

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.

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.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 GPT4 extension on VScode, GitHub Copilot, or Google Colab Autocomplete AI tools in Google Colab.Auto code-completion on Google Colab

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 communityDisregard Practical Coding Practice: Balance ChatGPT guidance with hands-on coding practice to reinforce theoretical knowledge with practical application.

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 Googling and community interaction with the innovative capabilities of tools like ChatGPT and auto code-completion tools.
Happy coding!

Let’s Connect

? Follow me on LinkedIn? Subscribe to my Medium newsletter so you will get an update on your email!? Please clap, underline and comment on this article if you found this useful

How Would I Learn to Code with ChatGPT if I Had to Start Again? was originally published in Towards Data Science on Medium, where people are continuing the conversation by highlighting and responding to this story.


View Entire Post

Read Entire Article