5 ChatGPT Features To Help You Code

Can't code? ChatGPT can help.

Overview

  • 5 ChatGPT Features for Daily Coding

  • Research and Compare

  • Understanding Code

  • Commenting Code Made Easy

  • Rewrite Your Code with Style

  • Get Ahead with Promptstacks' Accelerator Course

  • Product Picks of the Week: Chatbase & Water

Preamble

Don't worry if you're not a tech wizard, this week's newsletter will show you how to leverage large language models (specifically ChatGPT) as your very own coding assistant. We’ll take a deep dive into a few different use cases that you can use throughout your day.

Upskill with ChatGPT as a coding assistant.

ChatGPT has completely changed the way we can develop code

However, most software developers and data professionals still don’t use ChatGPT to improve  — and ease — their work.

This is why I am outlining 5 different features to increase both the velocity and quality of your daily work.

Let’s discover how 👇🏻

⚠️ Warning: You should never use critical code or information within ChatGPT.

#1. Generate your coding skeleton

ChatGPT is my secret weapon when it comes to building new projects from scratch. With just a few prompt submissions, it can generate a skeleton of the code I need, complete with my chosen technologies, frameworks, and versions. Not only does it save me at least an hour or so of work each time, but it also helps to keep my documentation — or team’s documentation— organised and up-to-date. It’s like having an extra set of hands on the team!

For instance, imagine I want to use an external API. I can ask ChatGPT to draft an initial code structure for me.

Generate boiler plate code that integrates an external API using Python.

And ChatGPT answers like magic:

Boiler plate generation

Or I can even ask for a skeleton (a basic layout of a project without any actual data) to scrape LinkedIn using Selenium, and ChatGPT gives me the following output. 

Easy, right? Try to challenge ChatGPT with any project you can imagine.

#2. Research and compare 

Making decisions on how to implement something can be tough, especially when there are multiple options to choose from. My go-to method is to create a basic proof of concept for each approach and then compare them. But, with the help of ChatGPT, this process just got a lot easier.

I can now directly ask it for its expert opinion on which option or library is best for my code development. This saves me time and effort in the decision-making process and ensures that I am using the best tools for the job.

Let’s imagine I want to work with geospatial data but I am not sure whether I should use Geopandas or a Plotly. I can ask ChatGPT to compare them for me — with a type included  —  and it answers right away with text explaining the main differences between both libraries.

ChatGPT explains to me the differences between GeoPandas and Plotly.

Now let’s assume I want to scrape a website (website scraping is when a computer program automatically collects information from a website. It's like using a robot to copy and paste information, which can be useful for research or making tools), I can ask what’s the best library to do so is. ChatGPT answers with the most popular web-scraping libraries in Python.

ChatGPT explains the most popular scraping website.

You can even ask what the best option for the website you want to scrape  is— even though ChatGPT will most likely warn you that it will be against that website’s content policy — so just be careful.

What’s the best option to scrape a social network?

ChatGPT explains the best option to scrape a social network.

#3. Understanding code

We’ve all been there (maybe not if you’re not a tech geek), struggling to understand a codebase that wasn’t created by us. Navigating through a complex and poorly-organised code  set— also known as spaghetti code — can be a frustrating and time-consuming task.

But, with ChatGPT, understanding a new codebase just got a lot easier. I can now simply ask it to explain the functionality of the code, which means I can understand it in absolutely no time at all. No more time wasting and wasted effort trying to decipher poorly-written code.

Let’s imagine I am trying to scrape LinkedIn and I find a random code on the internet that is supposed to scroll down the LinkedIn job offers website, but I’m not entirely sure what it does at each point. Well, we can sort this issue out.

What does the following code do? [insert code here]

Again, ChatGPT answers right away with a really detailed explanation of the code above. You can even ask for more details in a given part of the code — just play a bit with ChatGPT and you’ll discover what an advantage it gives you.

ChatGPT explains the code I didn’t understand.

#4. Adding comments to our code

ChatGPT can also help us to improve the quality and maintainability of our own code. By asking it to add comments line by line, we can ensure that our code is properly documented before shipping. This eliminates the need for uncommented code and makes it easier for others to understand and work with our code.

ChatGPT can significantly improve readability, maintainability and collaboration with others.

*be careful here, if your code is extremely private I wouldn’t suggest using it in ChatGPT

Add comments to the following code [insert code here]

Adding comments to your code.

#5. Rewriting our code using style

ChatGPT is not only a valuable tool for understanding unfamiliar code, but it can also help us to ensure our own code follows industry standards and conventions. By asking it to correct our code to conform with the Pep-8 convention — or even create a custom convention for our coding style — we can avoid the need for costly and time-consuming refactoring when merging code from different repos or teams.

This helps to streamline the collaboration process and make it more efficient.

Is we ask ChatGPT to write the previous code using Pep-8 standard, it will directly give us the re-factorised code.

Can you rewrite the following code using Pep8 standard [Insert code here]

ChatGPT giving our code following Pep8 standard.

Concluding Statement

I really hope that this article has helped you realise how awesome ChatGPT can be in boosting our productivity and making our work even better. I know some people worry that AI might end up taking over our jobs, but if we use it the right way, it can be super helpful for us.

But, it's important to remember that we still need to use our own brains and think critically when working with AI, just like we do with our human colleagues. So, before you jump into using AI-generated responses, take some time to check them out and make sure they're legit. Believe me, it's totally worth it in the end!

Promptstacks’ Accelerator Course

Participants will gain a comprehensive understanding of ChatGPT's strengths, weaknesses, and limitations. An excellent opportunity for professionals seeking to enhance skills with cutting-edge AI. *Includes 500 prompts.

28 lessons included.

Convened by Sean Melis (Ex-Deloitte AI Consultant).

"No regrets... The course material is concise and well laid-out. I love how the author added plenty of prompts for me to try. I've taken several ChatGPT courses already but this one is the best!!! Thank you, Sean!" — Maury

Promptstacks

This week our community reached 14,000 users.

For those who are interested in discussing prompts in Discord, please join our new Discord server.

Products of the week:

Introducing our top pick for the week: Chatbase! This innovative tool empowers users to create customized AI chatbots with ease, trained on any corpus, content, or data. Imagine being able to effortlessly access specific information from sources like the Bible, research papers, databases, and more. For instance, if you were curious about the exact moment when Adam and Eve left the Garden of Eden, you could simply upload the Bible to Chatbase and ask the chatbot to provide you with the precise text surrounding this event.

Currently Chatbase has free options.

Chatbase Product

Our second pick of the week is Water.

Author This Week

Josep Ferrer (Data Analyst)

If you’d like to write for Promptstacks sign up here.

If you find this newsletter valuable, share it with a friend, and consider subscribing if you haven’t already.