How ChatGPT makes my Coding Life 10x Easier (Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
recession layoffs chatGPT AI it seems like this is the worst time to become a software developer in this video Let's understand how there's a paradigm shift in how people program how in the last one month I have been using chat GPT very effectively in my workflow as a senior engineer and how you irrespective of where you are right now in college still trying to learn how to code or if you're currently an engineer yourself how you can Implement chatGPT in your workflow to become a 10x engineer and how this was never possible a month ago when chatGPT did not exist I'll also be talking a little bit around whether or not it will take your jobs what are the new jobs it will create and how you can seize the opportunity and if you use chatGPT effectively how you can become a better engineer and even if you have a low IQ even if you've tried to code in the past and weren't able to how you can now using your personal tutor become a 10x engineer with that let's get right into the video I think chatGPT or generally AI helping people to code is going to be a paradigm shift around how people used to code a lot of things will become very easy and a lot of new job opportunities will open up a lot of old jobs will close away as well and in this video I'll show you what are the kind of jobs I feel will go away and what are the kind of jobs that I feel will be built up how it will become very easy to code nowadays in fact in the one past month I have used chat GPT extremely effectively to Outsource a bunch of tasks that used to be manual tasks for me which makes me feel it's basically given everyone an intern which becomes super helpful especially if you're trying to learn how to code or if you're currently coding and you need someone to help out on a few things so if you're just here for the answer of the question whether or not chatGPT will take our jobs I think the answer is yes and no it will take away some jobs but it will create better jobs and will lead to a better human kind in the future that's my belief and I'm super bullish generally on engineering, coding, coders and software developers I do believe the number of jobs may go down but the quality of jobs and the quality of Engineers will go up which is usually a big plus for Humanity in general now comes the question of how I have implemented it in my own workflow so I'll be taking three practical examples of things that used to take me some time in the past and now are much easier for me and how I used to sort of write ugly code because I knew it will take me time to clean it up and how chatGPT cleans it up for me with that let's actually start some coding now I'm going to open chatGPT on my machine and let me show you the first place where chatGPT helped me a lot so the internet is filled with APIs if you've seen my last video the full stack roadmap you understand how to create HTTP APIs of your own there is a public repository here called public APIs which gives you access to a bunch of free public APIs that you can use to extract a lot of data a lot of times in your job you'll be needed to extract data from your API I had a similar problem recently so let's take an example of a random API here one famous API is movie apis if you want to create a website like IMDb you can do that with a bunch of open free data from this omdb API if you look at it it's basically an HTTP API you can define a bunch of parameters and it will give you a response the response will be a bunch of movies that you asked for for example if I search for a movie that starts with school it will give me a bunch of movies it gave me this movie which is titled School of Rock and I can use this API to create an IMDb website of my own now I had a similar use case where I had to hit an API and get back some data and I use typescript in my workflow now for those of you who don't know think of typescript as a stronger version of JavaScript that lets you define types now what are types if you look at here this is a very big Json object and you can tell what the shape of the data looks like so it has a title field a rated field so on and so forth when you're in typescript and you have to hit such an API it's always good to have a type for the response that you're getting and as you can see the response here is huge before chatGPT I would have to manually type out this response one by one and create a typescript now I can use chatgpt to offload this task let me show you how I go to chat.openai.com and if I simply type hey can you give me the types TS types for this object that's it it'll pretty much give me a type for this object which I can simply reuse in my typescript code now before chat GPT I would either have to rely on the developers of this open API to give me the type or I would have to write it on my own and it's very easy to fact finger when you're copy pasting such an ugly string and try to create its type on your own but thanks to chatgpt thanks to a task that's very repetitive very simple and can be done by a machine I can now do it so these are things that probably should be done by machines only there wasn't a structured way to do it before this now I can just ask it in a very simple fashion I did not even write typescript I wrote TS and it understood it needs to give me a typescript type so will this take my job away maybe maybe not I don't know but for today it has made my life much easier rather than worrying about whether or not it will take my job I'm happy I can Outsource a task which is very repetitive at least at the moment and now I have the tools to Outsource it to a mini intern of mine if you look at the type that it returned here it's a pretty complex type and it would have taken at least 15 minutes to write this from this but thanks to chatGPT it wrote it for me now this is just step one when I was interacting with that API a lot of times apis have clients a client is basically an abstraction to hit this API so let me just hit this API first so you understand what I'm doing here so if I go to this URL I've asked this API for a bunch of movies that have the title Horror in it I can also search for for example Harry and it'll return me movie that looks like basically Harry Potter now in my rust app or my golang app on my node.js app I need to send a request to get back this response I can probably ask app GPT to do it what if I tell chatGPT hey can you write code to hit this API let me just copy this and get back response that looks something like this use the type you defined above I think it should be able to generate the code for me that used to take me five to ten minutes to write again writing the type was the most difficult bit because that was manual and that was boring and as an engineer you don't want to spend your time doing that writing an HTTP call is not as difficult it wouldn't take you as long but if an AI can do it why not use the AI to do it so here as you can see it created a function for me function is called Fetch movie data which sends out an HTTP call to the omdb API and gets back the response and Returns the response the type of the response being movie here you can see it made a function call and then log the data in fact if I copy this whole thing and paste it in jsfiddle I think it will just work let's confirm that so after fiddling a bit on JS fiddle I realized something really dumb I hope you got this before I did but JSfiddle has JS in the name it cannot understand typescript it can only understand JavaScript so I'll have to go to a different compiler you can either compile it on your own machine or use something like replit and here I think I can do typescript code so let's create a new ripple and paste the code that we got here run it and I think now it should be able to get back the response let's see what it does it gives me an error it says cannot find module axios now I know what the solution is here but you can always ask chat GPT to fix this for you as well I get the error it says it seems that you haven't installed the axios package you can do that like this so if I copy this code and I paste it here in the terminal I think it should now work I'll show you very quickly how I can like create open source projects like this now thanks to chatGPT there are so many APIs out there that I can create very nice abstractions for open source them and I'm sure it will help out a lot of people so let's try to run this again and now hopefully you get back a movie response so here is when an error came and here is when I feel you as a software developer trying to use chat GPT might get frustrated this I think is an error that chatGPT might not be able to help you with one because it's happening on a third party platform I'm sure it'll get smarter over time but right now looking at this error firstly I don't think an AI or a human can understand this ver well I think this is very internal error we will debug this very soon but the idea is on my point is this is like off topic from this video but generally when you're programming and let's say you're a complete Noob at the moment you might use chatGPT to understand code or write such clients but then when you get stuck at a point like this you probably need a human to help you out so if you're learning to program I would at this point suggest you reach out and not just stop it tells you to just stop coding at this moment because you see a big error and you don't know what's happening you've done everything right but at this point is when you need people so feel free to join the Discord group and ask these questions I'm sure someone can help you out and now I will try to debug what the issue is here I'm going to think out loud I don't think chatGPT can help me here let me paste the whole thing here and let's see what it says yeah most probably I think I could be wrong but I think uh replit doesn't let you hit internet apis that's my guess I could be wrong I think that's why it's basically blocking this HTTP request and that's why we see 0.0.0.0 here versus what we should see so this is where chat GPT might not be able to help you my guess most probably is that this code is back-end code and hence is running on a replied machine and this replied machine has either stopped all internet access or is not able to resolve this specific URL because of DNS issues so a few Solutions here are either running this on your machine locally or a more elegant solution is if we just run this in a front-end project why is that elegant so again because we can still use replit we don't have to set it up locally but at the same time if I'm using front-end code all Network requests will go from my machine and we already know Network requests to the open DB API are working pretty well from my machine so I can just put the code that I put in the typescript backend project here maybe let me remove the Imports and take them to the top let me add axios as a library and then let's try to run this in a front-end project again as I said this is where chatGPT might not be able to help you because you're using an external provider it may be able to tell you what's going on under the hood but this is why experience helps a lot and that's why I'm sort of bullish on Engineers generally it might not take our jobs because there are small nitty-gritties that it might not be able to understand at least yet now let's try to run this code and see if it works again all this code to fetch the API was written by chatGPT so I haven't written it I understand it but I haven't written it there's a compilation error here let me fix that real quick so I've made the project completely empty I'm going to paste the code again I'm going to move this import to the very top and I'm going to try to compile it now it does run correctly and if I go to my console I should hopefully see the movie Object so as you can see I got the Harry Potter movie Object I see it twice if you can tell me why that'd be great let me know in the comments but basically I logged the movie Object here and I got it in the console which means if I search for Harry Potter which I did here if I search for something else you'll get the response for that specific movie but it works well this code that chatGPT gave me is able to hit an API get back the response now usually when you're working in the industry you're hitting these API endpoints you don't want this exposed in your code anywhere so you create clients what are clients, clients are basically sort of abstractions around this code classes that you create to abstract all this API calling logic into a class so let's try to see if chatGPT can do that can you create a typescript client for these apis question mark I think it should be able to there you go it says here's the types of client for the omdb API so as you can see it also like is able to figure out a lot of things on its own for example this is the omdb API probably can figure out that this is used for movies it was able to itself give it a very nice class name and hence like this is actually pretty smart it's created like extracted out a base URL string which it knows it's a URL and it's probably good to abstract that out into a different variable so it's pretty smart that way um it created a search movie function and it created a search movie detail function it somehow already knows this API completely I only give it one endpoint it was able to create the other function for me as well gave me a very nice client class that I can use in my final project hence these are things I used to write by hand before this every API unless they've the API has given a client like this themselves you have to sort of write it on your own now with the power of chat GPT you can automate it but I personally feel if you've written it at least once by on your own you will be much smarter and much better to use this tool versus like copying pasting from the beginning for example I don't know Ruby on rails very well let's ask it hey can you create a similar client in Ruby on Rails I'm sure it'll give me the code but I don't understand it I don't know where to put it I don't know how to put it I don't know how to use it so strong suggestion here is to First understand how to write these things on your own and then use it as your intern to offload tasks when you're good at them cool these were the two things I wanted to share as to how it has helped me as you can see it helps me with tasks that I already understand I know can be automated and I use it to automate those tasks I always also make sure I don't paste any of my internal company code here you shouldn't do that and one last thing I wanted to share another sort of common use case for me is to use it to fetch data for example recently I wanted to make an input box in the input box the user can put their phone number and select what country they're in it'll give them a prefix of their country code now for me to fetch all of this data from the internet and then convert it into a specific schema specific type is hard but I can just ask chatGPT to do it hey can you give me an array of countries phone number code in typescript I think it will just generate it for me so these are the other set of things I use it for this is a task that in big companies might just be the task of a different team so you assign it to a different team but now thanks to chatGPT it's able to poll the internet and give you a very nice object as you can see it created a type itself for this country object and is able to fetch all the data from the internet and give me this object that I can put in my input box so this is another place where I feel it's super helpful to scrape the internet for data and make the job of a software engineer much easier writing this scraping this from the internet shouldn't be the job of an engineer and hence you now have a mini intern to do it so these are the three things the three ways I use chatGPT today if you are a complete beginner though these might not be too relevant here as I said you should first understand how you can write these things by yourself and only then use chatGPT to automate your tasks else what will happen is something commonly known as imposter syndrome where you can do things you can maybe even join a company but over there you'll feel like an imposter you'll feel like you don't really understand things when people talk about Technologies you might not be able to answer it well because well you don't have chatGPT at all times like translating what people are talking about so strong suggestion here in fact very very strong preference for you to write these things on your own and then use it as a mini intern versus using it from the beginning I think that's really bad as you can see it created a Ruby on Rails client for me but I pretty much don't know how to use it I Now understand it a little bit because I've written HTTP clients in various languages but still I would first want to create a class like this on my own and then you chatGPT for it now what to do if you're a beginner I recently created a full stack roadmap and I gave out a full stack roadmap assignment I feel chat gbd might be able to just complete it on its own the assignment was to create a basic backend for a project and then basically all the code is here and I've added a bunch of comments on what to do I think if I copy this code and paste it in chat GPT tell it hey can you complete this it'll pretty much complete this code for me but should you do it probably not in the video also I explained the right way to use chatGPT as a student is to ask it small questions so that you can understand things you could always paste the whole code here and I'm sure it will give you the answer but um it's not the best way for you to learn what you should have done instead is started from the first comment add logic to decode body so the question should be how can you decode body or even before that like why what exactly is body inside app.post and it will tell you hey it's the HTTP parameter okay what's HTTP ask such smart questions so you understand things from the fundamentals your career is extremely long you don't want to use a machine so that you don't have to understand fundamentals because eventually those are what you need I sort of feel happy that I got to spend five years in the industry without AI because now I have dived deeper into various things I've chewed a lot of glass and hence I understand these things from the fundamentals I can always use chatGPT to offload tasks but I myself also understand what's happening might totally happen that the code that it's giving us here is not the right code and if that happens you really need to clean it up you need to be the one who cleans it up and hence you need to have your fundamentals strong so ask chatGPT the right questions use it as a mentor and not as a slave if you use it as a slave it might enslave you eventually let's look at the code that it's written so there is a sign up function that looks right it returns a 409 status code if the user with this email already exists else it returns a user registered success fully the login function that lets you log in if you log in correctly it returns you a random token if you ask for questions it gives you all the questions if you ask for submissions it gives you all the submissions this is actually wrong actually I'm going to paste this gist link is in the description go through this code yourself and try to understand what are the things that are wrong here I will explain them as well but like try to do it yourself and then come back to the video what's wrong here is you need the submissions only for a user you don't want this API endpoint to expose all submissions else you'll be able to see submissions of your friend which is not something you want and post submission sort of looks okay but you should probably store the user ID here so that you can fetch it correctly in this endpoint so not bad actually pretty good but I would use it as a starting point and not the end goal for my projects or for my clients wherever I'm using it most probably if you're a student right now trying to understand code use it as a mentor and ask it very nice specific small questions so you understand the language and by the end of it you can write everything yourself then use it as an intern hopefully my point here was put forward correctly it is extremely powerful it does have software developers a lot and I as a senior engineer I am using it effectively but make sure it doesn't enslave you and it will happen if you try to enslave it with that let's end the video I'll see you guys in the next Bye
Info
Channel: Harkirat Singh
Views: 93,331
Rating: undefined out of 5
Keywords:
Id: koybBUxiKW0
Channel Id: undefined
Length: 18min 2sec (1082 seconds)
Published: Mon Apr 10 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.