ChatGPT Crash Course | 10 Practical Use Cases For Developers

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's going on guys so in this video what I want to do is show you how I've been using chat gbt over the past few months as a developer using it in my workflow to learn and also to make me a more productive and faster developer so I know there's a lot of hype out there about chat gbt this isn't a hype video it's very practical and I just wanted to share with you guys how I've been using it now if you don't really know what chat EBT is it's basically an advanced AI chat bot where you can ask you questions you can converse with it back and forth and it will remember your your context and it's it's just a phenomenal technology and I think it's really going to change the game and I think we that we're only going to see more of this these types of tools in the future and it's based on the gpt3 model but now you can also use it with gpt4 if you're a plus user and GPT stands for generative pre-trained Transformer which is a language model developed by a company called open AI that uses deep learning to generate natural language text and it's been trained on a massive data set from the internet which allows it to generate responses to a wide range of prompts and questions and as far as what you can use it for it the list is is Limitless really I mean I use it for developer stuff but I'll use it for like health questions and stuff like that and actually have a conversation with it so it's just it's an amazing technology and I I didn't want to make a hype video I almost didn't want to make any video on chatgpt because I really don't like how everyone just jumps on the bandwagon and makes videos on stuff when they don't even really know what they're talking about so this is this is my perspective this is what I use it for and I'm just hoping that some of you will you know pick up on some of it and integrate it into your own work flow and and you know help you with productivity all right so let's jump into it and let's let's look at 10 ways to use chat GPT as a developer foreign so once you log in you'll see an interface like this which is very very simple and notice mine says plus that's because I'm logged in as a plus user which is twenty dollars a month and I'm basically paying for reliability so that it's always up so I don't get any error messages telling me that I can't use it and it's just it's good to have if you're going to be using it a lot if not then stick with the free free version so in the Middle top here we have the model that's being used which by default is GPT 3.5 okay now as a plus user I can choose gpt4 but it has limitations So currently at this time if you're watching this in the future this may have changed but right now there's a cap of 25 messages every three hours all right and it's noticeably slower you can see here the little um the little rating things here so speed is at a two while GPT 3.5 speed is at five so it is noticeably slower and you'll see when I at when I prompt or I ask a question it doesn't just plop the text on the screen it kind of types it out so I'm going to stick with gbt 3.5 now this brings us into the first way that I use chat GPT for for development and that's just as a general learning tool so we all have a preference when it comes to learning something new whether that's video tutorials courses articles books documentation other people's code other people there's so many different ways to learn and everyone has a preference and I think that not only chat gbt but just Ai and chat bots in general are a new thing that we can add to that list and honestly it's one method that could put people like me out of business people that teach online courses and so on but I don't freak out about it because as I know that there's still a need for that there's always going to be a need for the human element now when it comes to using chat gbt as a learning tool a general learning tool you're going to develop your own strategies in terms of finding what you want just like you do with Google and stack Overflow and anything else so before you you develop your own strategy I can tell you what I recommend which is getting steps examples and resources so instead of just saying like let's say we want to learn the fetch API instead of saying what is the fetch API let's ask for the steps to learn the fetch API so say I want to learn about the fetch API and I'll say what are the steps that I should take and before we go over the the response here I just want you to see that on the sidebar now we have a new chat and it will name it but we can rename it if we want and what I usually do here since we can't have folders for different categories which I think would be a great feature what I do is give it a category so I could say like JavaScript and then colon and then say fetch API that way if we have any other conversations that have to do with JavaScript I can prefix it with JavaScript all right and then you can delete it you can also clear all your conversations but everything that we talk about in this context is going to be saved even if we open a new chat we start to talk about something completely different we can go always go back to this this conversation now as far as what it gave us you can see it's a pretty well written list of steps so understand the basics of HTTP familiarize yourself with promises learn the fetch API syntax and all that practice with examples explore additional features consider compatibility stay up to date so pretty good list and again you can just keep this conversation and you can always reference back to it now what's really great about chat GPT isn't just the the the answers that it gives you but the fact that you can conversate back and forth and it remembers context if you've ever tried this with like Amazon Echo or Google home and you ask a question you get some half-ass answer if you ask another question and you try to reference what you just said it doesn't know what the hell you're talking about so chat gbt is great for that so what I'm going to do is say tell me tell me more about and let's see we have let's say number two just by me saying number two it should know what I'm talking about and it says sure promises are a fundamental part of JavaScript blah blah blah and it gives me an example and that brings me to the second thing which are examples so it'll give you code examples they're not always correct I do want to stress that especially if it's more complex stuff you might have to prompt it a few times to kind of get you know get what you need and we'll go we'll get more into that in a little bit but let's say show me an example of the fetch API and a post request okay so it gives me an example it's using data from a form and then making a fetch request it's putting the form data in the body getting the response it's checking for any errors and getting the Json all right and we can ask for something else or we can ask to change this up like let's say show me show me this example using a sink await and there we go so it gives me a func an async function called login and then does the same thing except we're awaiting on the fetch fetch requests and we're getting our Json so that's examples and then I'd also say ask for resources chat gbt itself is a resource but you might you might want to watch a video or books or whatever so I'll say what are some good books I'll just say what are some good books and it should know what I'm talking about that I mean the fetch API so there are many great books on web development and related topics okay maybe it didn't specifically um it didn't specifically answer with the fetch API so I'll say what what about books good for the fetch API okay so some recommendations we have fetch API in depth by Jake Archibald modern JavaScript collection JavaScript novice to ninja let's say what about YouTube videos so we get fetch API tutorial by travesty media working on working with the fetch API by Wes boss net ninja so all great resources free code Camp so those that's what I would suggest just for learning in general uh ask for steps ask for examples and ask for resources now another thing that it's good for is code feedback asking it to look at your code and make any suggestions so I'm going to open up a new chat here and then I'm going to grab some code from a GitHub repository and I'm going to use the 50-day 50 projects 50 days just because they're small projects and there's just a single Javascript file in most of these so let's grab the drawing app take our script.js copy that code and then I'm going to come over here I'm going to say can you provide some feedback on this code and you don't have to format or anything just paste it in so the code looks well written and organized here are a few suggestions add comments to describe each section of the code this will make it easier blah blah blah add error handling for example if the canvas element is not found the code will throw an error you can add a try catch block so that's that's I don't disagree with that consider adding touch events in addition to Mouse events okay consider adding keyboard shortcuts to make it easier for users to interact with the application so I think this is really useful especially for someone like me that works from home that doesn't have any other developer around to check my stuff and give me suggestions the only other option I have is to post in a public forum which oh doesn't always go that well so I think it's a a great way to use chat GPT so the next thing that I want to look at is finding solutions to specific problems and not even just problems but just little tasks that you want to do so let's say we want to scrape a web page using python so I'll say how can I scrape a web page using python so scraping a web page in Python can be done using various libraries such as requests and beautiful soup 4 and lxml and it gives us an example so we're importing requests and beautiful soup we get a URL that we want to scrape get the response pass it into a beautiful soup instance and then we can get the all the links or all the paragraphs whatever it is that we want so very simple and of course you could just you could Google this go through a few pages go through the beautiful soup documentation but that's going to take a little bit this is going to increase your productivity so let's say we want to create a just a help a utility function to convert Celsius to Fahrenheit let's say give me a function to convert and I'm not even going to say Celsius to Fahrenheit I'm going to say C to F and we'll see if that works so here's a function that creates converts temperature and Celsius to Fahrenheit so I it knew what I meant just by C to F all right and it's using python I didn't specify it here but since we're already using python in the past prompt it's going to use Python but we could say what about say what about JavaScript and it will give me the same code in JavaScript another thing that this is useful for is brainstorming and it could be for anything it could be brainstorming a name for your company or just ideas for an application let's say that again we're learning JavaScript we just learned how to use the geolocation API we want to create an app that utilizes it so I'll say give me some ideas for an app that uses the geolocation API all right so let's see local events an app that uses geolocation to provide users with a list of events happening in their local areas neighborhood guide campus map running app travel app geocaching app emergency services so some pretty good ideas that are generated for you if you don't like any of these you can ask for more and if you want to proceed with one of them like let's say how would we I'll just say tell me more about number three which is the the the campus map sure a campus map can be useful a useful tool for students faculty and visitors to navigate around a college or university campus and gives us goes on to gives us some features and you can just keep going with this and it's going to be a kickoff point for for a new project all right so the next one is huge for me and that's generating sample data because oftentimes I'll need a bunch of sample data for a project and I hate trying to figure out which type of data I should use and then thinking of all the fields and values and then typing it all out we can get ideas on data as far as the the type of data the fields the values we can get all that from chat GPT it can also help us generate the data itself and I've used this for my own projects and for my own courses it's a huge Time Saver and it can be formatted in any way you can think of Json CSV XML whatever so let's go ahead and let's ask for some sample data for some some coding boot camps I actually did an API for coding boot camps in my my node.js course and this would have been helpful back then because I had to you know think of it all and type it all out myself but I could have now I could just say I need some say I need some sample data I need a Json array with what should I say here I'll say adjacent array of 10 coding boot camps with at least 10 Fields each all right let's see what that gives us so we get an array Json array and we get objects of bootcamp so name Flatiron School location website programming languages programming duration tuition job placement curriculum ratings so this is is probably my one of my favorite uses for chat GPT and if if I don't like something here like like let's say I don't want um let's say I don't want the programming language I'll say take out the programming languages field so now if I scroll down it's gonna it should give me the same thing but it'll leave out the programming languages field and there we go so no programming language field now let's say I want this in a different format I'm going to say give me the same data in let's do we'll just say in XML and now we have all of our boot camps in XML format and there are websites that can do this kind of stuff like macaroo there's other services and I think a lot of those I don't want to say they're going to go obsolete but I think that in a lot of cases chat GPT and open AI Tools in general even some of the apis are going to replace a lot of those little services so the next thing that I want to look at is writing documentation so let's open up a new chat and I have an old laravel API that I want to see if it will generate documentation for so let's see it's called The Articles or L articles right here and all I'm going to do is is take the URL so I'm going to copy the URL and you can be specific about what kind of documentation do you want do you want markdown or yaml or whatever I'm just going to say give me or let's say generate generate the documentation for this laravel API and then I'm just going to paste in the GitHub link all right so right away it gives us this document with the the base URL the end points so get slash articles it gives us an example of a response get a single article gives us a response create an article so just by giving it a URL just by showing it to GitHub it was able to generate all this for us and then even authentication gives us the access token back so to register a user Etc and I'm just generalizing I'm not being specific at all you can really specify what kind of documentation what should be included you know I I'm just saying generate some docs and it's it's giving me a pretty good response all right so the next thing is getting getting more information from errors because we've all gotten crazy errors that we we don't understand we don't know what the hell it means in fact a recent example is I actually run a modded Minecraft server and it was crashing and chunks weren't loading so I decided to go into the logs and I just grabbed a big snippet of the log file and I pasted it in chat gbt and it knew exactly what was wrong it told me which mods were causing the issue which ones to disable and it helped me debug my Minecraft server so that's why I decided to to pay 20 a month because I literally use this thing for everything and I know it sounds like I'm trying to sell you something but believe me I don't get any cut or anything from this I just want you guys to be able to use this to help you in your you know in your life in general now just to give you an example of kind of the workflow when it comes to error messages I'm going to just open up that's not right I'm going to open up the code for a simple state capital search in fact I'll show you the the project I believe this was an old YouTube video but I'm just going to open this up and show you that we can just search for you know Ma and it'll show the states that start with Ma and it'll show the capitals and it's just coming from a Json file so I want to break this on purpose so let's go back into the code here not the HTML I want the JavaScript and what I'll do is where we're getting the matches so we're basically matching a regular expression I'm going to change state I'm just going to add an S to that so that's going to break the application so if I come over here now and I open up my console and I try to search you can see I'm getting this type error I cannot read properties of undefined reading match it tells us the line number and this is pretty easy and pretty self-explanatory to fix but let's just say that we don't know what's happening so I'm going to just copy the error message and what I'll do is go into chat gbt and just say can you tell me what this error message means and how to fix it and then I'm going to paste the error message in and it needs to obviously it needs to know the code as well I mean I could ask what it means but I wanted to fix it too so I'm going to grab all this code and copy it and I'm just going to hit space and then paste in the code so it doesn't have to be formatted nicely it'll figure it out all right so the error message let's see means that somewhere in the code the program is trying to access the match property of an object that is undefined or null in this particular case the error is occurring on line 12 where the match property is being accessed on the states.name object so to fix this error you should change the filter function on line 10 to access the name property of each state object so as you can see it took away the s that I added all right so it's telling me exactly how to fix it so if I grab this and go back into whoops again that's the wrong code we want because I have so many damn windows open so I'll just replace this with what it gave me save it and let's come back over to the project type in m and now it works so that's the workflow for getting an error and trying to fix it it doesn't always work out that smooth that's a pretty simple error to fix but uh but that's the workflow that I've been using as far as using you know finding out what errors mean all right now I want to continue to use this project to show you the next one which is writing test or creating unit tests so you can have chat GPT create unit tests for you and it could be in any language any testing Library I'm going to use jest so I'm going to say can you give me I'll say can you or I'll say can you generate a unit test for the search is it search States I think it's called search States for the search States function using jest and let's see what it does all right so sure here's an example so bringing in the file describes search States function test returns an empty array when search text is empty all right returns an array of matching States when search text is not empty so it's passing in Al here as an example and it should equal this it should equal Alabama okay and if it's empty then it should equal just an empty array so it generated this test that we can now run using the jest testing Library so the next thing that I want to look at is natural language programming which is I talked a little bit about before and I think really scares a lot of people because they feel like it's going to put them out of a job but I think in many cases it's just going to change your job and in many cases make things easier for you because you'll be able to to do things faster because you can you don't actually have to write the code you can instruct the AI on what you want to do now I still think you're going to have to really have a good foundational knowledge in programming in general but I think you'll be able to switch from language to language as long as you understand the fundamentals you know for instance if you want to create a rest API you have to understand what goes into that you might not have to know the exact syntax though because of natural language programming so let me give you an example I'm going to say new chat and I'm going to purposely use a language that I don't know too much about I know a little bit of rust I've dabbled with it but I wouldn't say I'm fluent in it by any stretch of the imagination so we're going to use rust let's say I need a rest API built with rust and I'm going to say it should have it should have products with the fields of ID name description and category underscore ID and I'm going to say the category ID should say should have a relationship with another resource called categories okay so that category ID I want to be connected to categories and let's say categories should have an ID and a name field so I'm constructing my data here just in in plain English and then I'm going to say let's use let's use an SQL we'll say SQL Lite database and I'll say use any Frameworks and libraries that you see fit all right so before I go ahead and submit this even if I don't have any knowledge of rust I need to know how apis work I need to know how collections or tables work Fields relationships I need to know what kind of database I want to use so let's just go ahead and run this and see what we get so it's going to basically give us instructions on how to create this because obviously it can't just like log into your machine and create your files for you at least yet probably at some point it will but for now it's telling us to create a new app using cargo add our dependencies looks like it's using rocket which is a framework and then we're constructing our tables so categories with an ID and a name type is integer and text products has an ID name description and a category ID and then we're joining the tables because remember I said to have a relationship between category ID and then the ID and the categories table so it creates that then we're defining our models so creating our category model and down here creating our product model now it does this a lot it kind of it just stops and it does this when you have just a lot you know a big response so what I usually do it usually works is you can say continue we'll say continue where you left off hopefully that will be fixed in the future so it says whoops sorry about that here's the rest of the code so it like just falls asleep or something all right so we're establishing a connection using sqlite database URL and then we're creating our endpoints right so slash categories function call get categories and we're getting we're going to um print out the Json so the category is Json from that route then we can get the category by ID down here post request a category is going to create a category so even though I'm not very fluent with rust I mean it's pretty clear what this is doing because I understand the fundamentals of of a rest API and data models and all that stuff so I think that understanding those fundamentals I think that stuff is going to be really really important moving forward the syntax the code syntax that you're learning isn't as important as knowing what is actually happening and I think that's always been true but I think it's going to be even more true with AI with all this new technology all right so the last thing that I want to look at is creating uis using either just HTML and CSS or using Tailwind or bootstrap or anything like that even using react UI libraries you could do that but we're just going to stick with HTML and CSS and I'm just going to paste in the text here and I'll read it so I said I need an HTML and CSS I need HTML CSS in separate files for a Blog home page with a navbar with a logo on the left and links on the right a hero area with a background image and centered text under that should be three cards in a horizontal Flex box the card should have light a light gray background and a box Shadow use Light blues and greens and use the Poppins font okay so we'll see what that gives us now I will say that the UI stuff the design stuff is probably one of the weak points when it comes to getting help you can you can get something really cool but you have to work with it I'm sure that the first run with this isn't going to look very good but we'll see what we get so I'm going to copy that and then I have vs code open with just an HTML and CSS file so we'll save that and then we'll grab the CSS and let's throw that in all right so we'll check that out let's go ahead and open this with live server all right so that that doesn't look too bad actually I mean it doesn't look good but as far as what I asked for for the layout it's correct I asked for a nav bar with the logo over here links over here here with a background image with some text and then my cards horizontal cards let's see is it well it's not responsive but you could just go back and say you know add some media queries and make it responsive it's going to take a while you're not just going to get a great layout from one prompt you gotta you gotta work with it but for people that aren't great with CSS and in alignment and all that I think that it can it can really be beneficial and if we look at the CSS so let's see we have our general Styles it even gives us some comments for the different parts so we have a reset we have our font Poppins font our navbar which uses flexbox justify space between so this is pretty much what I would do hero 400 picks for the height we have a random image from pixum uh yes this all looks good I mean you should probably have an overlay For Your Heroes because it's not very readable but you can go back and you can ask it to do that card Styles so you have your card container which is a flex box padding 50 pixels yeah so I mean it's it's not too bad it's better than I expected it doesn't look that great but the structure is there so you can continue and work off that all right guys so I know this was a long video we did a lot but hopefully this hopefully you can take at least a couple of these and integrate them into your workflow I think it will really increase your productivity and I think it'll help you learn in many cases so that's it hopefully you enjoyed it and I'll see you in the next video
Info
Channel: Traversy Media
Views: 141,426
Rating: undefined out of 5
Keywords: ChatGPT, ai, chatgpt crash course, openai, open ai, artificial intelligence
Id: o_joulYVndM
Channel Id: undefined
Length: 32min 33sec (1953 seconds)
Published: Mon Apr 17 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.