Coding Overview

In this lesson, we will explore the various ways ChatGPT can help you with coding, even if you’re a non-coder. We will cover code generation, error detection, code summarisation, code translation, code improvement, code documentation, learning to code, brainstorming, and creating slideshows for potential investors.

Key Takeaways:

  1. Code Generation: ChatGPT can generate code in various programming languages, including HTML, CSS, JavaScript, and more.
  2. Error Detection: ChatGPT can find faults and errors in your code and provide solutions.
  3. Code Summarisation: ChatGPT can explain complicated code in simple terms, making it easier to understand for non-coders.
  4. Code Translation: ChatGPT can translate code from one programming language to another, like JavaScript to Python or Ruby.
  5. Code Improvement: ChatGPT can analyse your code, suggest improvements for efficiency, and increase security.
  6. Code Documentation: ChatGPT can create README files or documentation for your projects.
  7. Learning to Code: ChatGPT can teach you how to code in different programming languages, providing step-by-step lessons.
  8. Brainstorming: ChatGPT can help you brainstorm features and functionalities for your software projects.
  9. Creating Slideshows: ChatGPT can create slideshows for pitching your software ideas to potential investors.

Next Steps: In the following lessons, we will dive deeper into each aspect of coding with ChatGPT, demonstrating the process and providing more examples. If you have any questions or need help, feel free to reach out to the community.

Action Items

Please note, to get the Google Sheet, you need to click on the link, then File > Make a Copy.

Then you can edit the sheet in your own account if you need to add any notes etc.

Transcript

Coding. So this is going to be a really exciting module of this course and one that we’re going to break down into several different video lessons, actually, because there’s an awful lot that chat GPT can do in terms of coding. Even if you’re a non coder, you are going to find this very, very useful and you’re going to gain some new skills that you didn’t even know you had because now you’ve got a coding assistant that sits on your computer or phone wherever you are. So let’s get stuck in and how can chat GPT actually help you with coding? Well, the first thing it can do is just straight up generate you code, and it can do so in a variety of different languages as well. So it can be used to generate code snippets, write complete software programs in just about any language that you’ve heard of, and it can also help you with building user interfaces as well. So that’s the first thing that it can do. And it literally is as simple as asking it to write you the code. So let’s just go over to chat GPT and just give you a really quick demo of what that looks like.

Can you write me the basic code to produce a simple website with the words Hello World displayed? And then it will get busy. I’m using chat GPT 4, but of course, you could even do this with 3.5, no problem. Here’s a basic HTML and CSS code for a simple website displaying Hello World. And it’s giving it to us in a nice, easy format that we’re able to then just copy that code and then save it as a. Html file. And then you’ve got yourself a website, literally that quickly. Then it’s creating the CSS styles that gets applied to that website that makes it look a certain way, makes it look pretty. In this case, it’s put an H1 tag to make the Hello World very big. And then it’s chosen the font family of Arial. So it’s a really, really very, very skilled tool at creating code for you, even if you’re not really an expert. We will have specific example videos on this. So I’ll just go do a video on actually creating a website and showing you the process. But that’s just to demo there that it can create code right there in front of your eyes.

Next thing is error detection. So it’s really good at taking code and then basically finding any faults in it. So if you’re having a go at building some code and you think it’s just not working, what is going on with this? Put it into chat GPT and ask it to find any errors. So if I was to, for example, take this code here, which… No, let’s go with something more complicated. Here we go. Here’s some code right here on this website. This is, I think, JavaScript. And what I’ll do is I’ll just ask chat that GPT to find any faults with the code. So please can you find any faults in the following code and then detail what they are in plain English? There we go. So I’ll take the code and I’m going to deliberately mess it up, and I’m just going to get rid of an S in the script there at the end. And then let’s see if it can find that problem because that should ruin the ability for it to do it. So we’ll press Go and there we go. There is one primary fault in the given code, which I will explain in plain English.

The opening script tag is missing its corresponding closing script tag. Instead, there’s a typo with crypt to fix the issue, replace crypt with script, and that’s it, done. And now it’s going to create the entire code for us with the corrected actual script at the end of it. So brilliant for doing that. It’s sharp as a razor when it comes to code. So we’ll stop that generating because it’s just burning through the code there. And so really good. Error detection. Next thing is code summarisation. So what we could do now is ask it to tell us exactly what that code is doing in plain English. And I think that’s a really good idea, too. So if I just say to it, can you explain what the following code does in a way that a noncoder would understand? Here we go. So we’ll paste that in now. That’s fully working code. I’m just going to change the spelling of coder to coder. There we go. And now let’s see if it can do that. So this code creates a multiplication table displayed on a web page, and I’ll explain it step by step in simple terms.

Look at this. Beautiful, isn’t it? The title of the web page is set to multiplication table. When the page is opened, it asks the user for two inputs, the number of rows and columns and so on. So it’s giving this to us in a way that we can really understand what’s going on, which is very helpful if you’re not into coding. And I’m not a coder, by the way. So this is a great facility to have at hand when you’re really not sure about something. And there we go. We can just stop that generating away there. So it’s brilliant at code summarisation and explaining complicated coding in simple terms we can all understand. The next thing is code translation. Now, this is a really clever facility that it has too. It actually is able to understand 21 or more different languages. Now, on this spreadsheet that comes in the coding section underneath this video, you’ve got all of the languages right here that it’s very familiar with, and a brief description of each of them, too. So Python, Java, JavaScript, C, Ruby, php. There’s a whole load of them here, some of you probably never heard of and will never use.

However, the popular ones are right there. But what it can do is just translate it from one language to another. Okay, so what I’ll do now is get it to translate some JavaScript into Python, another language. Can you translate the following code into Python? There goes the code, and then now we’ll let it get to work. Here’s the equivalent Python code to generate the multiplication table. And there we go. It’s just translating it over. And the crazy thing is, we can keep going with this. We could say, Hey, can you translate this Python into Ruby? And it would do the same thing. It’s pretty amazing at doing its job here. So we’ll just stop generating that because that example over. So code translation, useful skill. The next thing will be this, which is code improvement. So it may be that you or a system has created some code and it’s just not as good as it could be. So what better than to have chat GPT, look over your code and try and improve it for you. And in some cases, it can also increase the security of the code, which is very important. If you’re trying to build an app or something, you want it to be very secure, you need to have chat GPT help you to make sure there’s no loopholes that hackers can get into.

It can also help with making things more efficient, like making less API calls or making memory usage much more efficient so that your apps are really high quality straight out the gate. So if we were to go over to chatGBT now, we could try something and just say, can you recommend any improvements to the following code to make it more efficient? We’ll paste in our same code again and let’s see what it can do. Here are some improvements to make the code more efficient and clean. Use let instead of var to declare variables to limit their scope. Replace the while loop with a for loop to simplify the code. So it’s given five different things here and then given us the updated code as well, which we now know is more efficient. So this is absolute gold. I mean, back in the day before this, so I say back in the day, we’re talking like prior to December 2022, if you were not a coder, this would be a job that you’d have to put out on Upwork or Fiverr or something and have somebody do. And then trust that they are a good coder and that they have managed to make the code more efficient and improve it.

Now, we’ve got this and we can do it in seconds as a noncoder. It really is incredible. It really is. So there we go. That’s how you can use it to do that. Next thing we can do is code documentation. Now, this is a really good thing. If you create a Chrome extension or some an app using Chat GPT for the code, you often will… Well, you definitely will require some documentation that goes with it to explain it to people and how it all works. So again, we can go to Chat GPT, and then we could just ask it to do a README file for that. Could you create a README file for that script that you have just generated? And then off it goes. Here’s a README. Md file for the Improved Multiplication table. And then it’s just going through now and writing away everything about the actual code, the script. This, again, can you imagine the time saving of this? This is such an important part of having any script as a README. Usually, they’re in a text file, they’re in Readme. Txt, so you can just copy this code, put it in a text file, save it with your app, and then when somebody installs it, they’re able to just open this up and get really clear instructions on exactly how to use it.

I mean, look at all of this. It’s got how to use, what it consists of, an overview and everything. To be honest, writing this as a human, I’m not sure you could do a better job. This project is open source and available under blah, blah, blah. And then it’s got the open-source thing there. So this is a really, really useful skill of Chat GPT when it comes to coding as well. The next thing you can do is you can use Chat GPT to learn how to actually code, even if you’ve never coded before. And in fact, I’ve put this prompt here to help you out. In the coding example prompts, we’ve got example prompts for every single section of this training right here, like code generation, error detection. These are all example prompts that you can copy and paste in and just alter to your requirements. Code summarisation, code improvement that we’ve just been using, code documentation, and then also actually having it teach you how to code. And this one’s really cool. Let’s just take this last prompt here and then we’ll go over to chat GPT. And I used it earlier on.

Let’s go with this one. I pasted in that very, very prompt just there. I want to learn how to code in JavaScript, please provide me with a lesson plan and then implement the lesson when I type ready. So first of all, it comes up with a really good lesson plan. It’s very thorough. That takes us from being a beginner to being able to hopefully use JavaScript, at least in a basic way. It says there, look, once you’re ready to start the lesson, type ready. I type ready, and then there we go. It’s off. Let’s start with lesson one and your introduction to JavaScript. And it’s given us a little bit of history about who developed it, Brendan Ike in 1995. And then it started giving us a lesson on how to create a little website that says Hello World using JavaScript. So basic stuff. Like it says there, this is just the beginning. Next, you’re going to learn about the basic JavaScript syntax, data types, and operators in lesson two. And if you have any questions or need help, feel free to ask. So you just type ready and off it goes. This is absolutely awesome stuff.

You have a tutor now at your fingertips who can teach you coding. Amazing. Next thing it can do, brainstorming. Now, what if you’ve got an idea for some software or app and you just want a little bit of help from Chat GPT to really refine your idea? Well, it’s awesome at doing that, too. So let’s go back over to our prompts and then we can ask it this first prompt here. Let’s just use that one. I haven’t tried it, but let’s just go ahead and try it out. I’m just going to shrink that down. So new chat, we use GPT 4 in the hope we get some intelligent answers. And there we go. So I have an idea for a software product. Can you help me brainstorm features and functionalities? Absolutely. I’d be happy to help you brainstorm features and functionalities. To begin with, I’ll need a brief description of your idea or the problem your software aims to solve. Okay, let’s just do an example software here. I’d like to create a chatbot creator platform that allows people to create a chat pot that will help with customers who have issues and it is trained on the person’s business data.

Okay, we’ll get rid of chat pot because I’m not sure why I did that. Let’s move chat DBT and off we go. A chatbot creator platform specifically tailored for your business to help customer support is a fantastic idea. Here are some features and functionalities you might want to consider with your platform. And there we are. User-friendly chatbot builder, prebuilt template, customizable chatbot appearance, multi-lingual support for different languages, and it’s off. So these are things that you may not have thought of. Let’s just say multilingual support. Maybe you didn’t think about that. You were just thinking of just doing the one. So it’s going to help you create a better product. And then, of course, after you’ve done all this, it can even help you code it, too. So that’s why it’s a really, really helpful assistant when it comes to coding. It’s absolutely going off on one here, isn’t it? Look at this, omnichannel support, role-based access control, so we can have team members use it as well. Gdpr and privacy compliance. It’s perfect. Really good. Now, of course, you could put all this into a slideshow as well if you were trying to get investors.

In fact, we could have it now just create a full slideshow from this so that you could demonstrate to potential investors that you’ve already researched the software and what you need to do in order to develop it. So that’s another really useful case here for chat GPT. So this just covers the overview of how you can use chat GPT when it comes to coding. And now what we’re going to do in some more lessons is to actually use it to create various things so that you can see the whole process of how it works. And hopefully, you found this really useful. If you did and you’ve got any questions as well, just get in touch or just put a message out on the community and I’d be really happy to help. All right, that’s it for coding for the moment. Thanks for watching.