Solving Big Problems With GitHub Copilot

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi I'm Christopher I'm a senior Enterprise Advocate at GitHub and I want to talk today about GitHub co-pilot and how it helps me as a developer you see I became a developer because the job seemed like it was an awful lot of fun and oftentimes it is but there's also an awful lot of tedium what I want to be able to do is solve the big problems and come up with unique Solutions but what I really find myself doing a lot is writing boilerplate code dealing with obscure syntax and having to learn an awful lot of new languages and Frameworks co-pilot can eliminate the repetition it can help keep me in the Flow by reducing the number of times that I have to leave my IDE to go look something up so how does it do this magic well let's take a look I have here a python Django application and python Django is a great web framework that's built for creating front ends to back-end databases the first thing that I need is a model and this can be repetitive code so using natural language I can describe what I want I can say create a model called speaker with name email and LinkedIn URL and now we get some gray italicized text that is my code suggestion from copilot it's suggesting this class speaker I had tab to accept it and then I notice an entire class suggestion from copilot all based on that one sentence comment I hit tab to accept and now that's been built for me now how does GitHub co-pilot make its magic happen well it's based on a training model that consists of billions of lines of publicly available code and text that allows it to synthesize that natural language comment into a code suggestion it's also able to make suggestions that follow best practices it's a very common best practice in Django for example to override the string function so that way we can get a string representation of an instance of an object and sure enough in that suggestion that copilot made it went ahead and included that we also notice that copilot is able to read my code and make suggestions based on that so it gives me a suggestion down below of a brand new comment to create a talk model because it saw that I had a speaker it goes hey wait a minute you've got the speaker they probably need to do something here's a talk for you and I can Loop through a couple of different suggestions that it might be making based on what it sees and then hit tab to accept so I'm going to accept that comment I hit return I hit tab to accept the next part and then hit tab to accept the entire class that it's now generated forming one of the other big places where co-pilot shines in keeping me in the zone is helping to reduce the number of times that I have to go look up some bit of syntax I generally speaking can get around regular Expressions but quite frequently I need to go look up that syntax but with copilot I can just stay in the flow I can describe one more time in natural language what it is that I want let's say I want to add on a code field with a pattern of three uppercase letters a dash and three digits and copilot actually even suggested the rest of the way because it saw what it was that I was trying to do and I hit return and now co-pilot will make a suggestion for me of a regular expression so I didn't have to go look up that syntax copilot did that for me right here GitHub copilot Works across languages and Frameworks we've already seen how it can help us out with a python Django app but what about say C sharp and a web API app well I have a model and validator and data context already set up and I want to now create a controller a controller that typically involves an awful lot of tedious boilerplate code well I can just code like I normally would I'll add in my speaker controller I will begin to import in the appropriate namespace so we'll say using and then Microsoft asp.net core MVC which you'll notice that copilot is suggesting it's also suggesting my Entity framework core and now I need to go grab my data model so I'll say using conference dot data and then now what you're going to notice is that copilot takes over the rest from here it sets up my namespace for me it adds in the appropriate attribute for API controller and sets up the route and then generates the entire controller for me I wrote maybe about a line and a quarter worth of code and it took care of the rest for me now when you see that gray italicized text you might be thinking gosh that looks an awful lot like intellisense and you might then be wondering well what's the difference between intellisense and copilot well intellisense is wonderful at making small suggestions it can help remind me what the name of a variable is or help Point me at a particular method but it does require that I get a big part of the way there that I'm already starting to write my code but with copilot I was able to say in natural language this is what I want and get an entire class suggested forming something which intellisense isn't able to do you also might be wondering well what about chat GPT and chat gbt is a fantastic external tool but it's going to lack context co-pilot knew that I was creating a Django application and the code suggestion that it made was based on that that if we notice with our speaker class it inherits from models.model which is exactly what we want with a Django class if I was using chat gbt I would have to go to this external tool I would have to describe the entire scenario the Frameworks that I'm using eventually get a code suggestion that I would then have to copy and paste over to here co-pilot meets me right where I am and in the tools that I'm already using if you're using visual studio Visual Studio code jetbrains or neovim there's a plug-in or extension that's available to you for GitHub co-pilot and you might be wondering does copilot obviate developers is it going to obviate my job and the answer is no you still need to have a developer copilot does not generate perfect code you'll notice in my example here that when it created the reference between my talk and my speaker it said it such that if we delete a speaker that has a talk it's going to delete all of their talks and that's probably not what I want so I can go back and make the update to that code to ensure that that's now going to be protected so that's going to block a speaker from being deleted if they have a talk so I can modify all of the code that it generates and I want to make sure that I still review it I also want to ensure that it goes through all of the standard checks that I have for code that I wrote or anybody else wrote that's going to be committed into our code base this includes our security checks code quality checks linting Etc co-pilot is a co-pilot not a pilot and what co-pilot will do is allow me as a developer to focus in on the bigger picture and so if we bring it back to my code one last time here and let's say I want to register all of those objects all of those classes that I made with the admin page I can come over to my admin pie and notice that copilot based on all of its training data based on its scent of my context starts suggesting the code that I need so I didn't even need to add in any comments I didn't need to write any code and copilot made all of those suggestions for me and we see this reflected in the survey data that we get back from developers that have access to GitHub co-pilot for business 73 percent report improved job satisfaction and 87 percent report a reduction in repetitive code get up co-pilot also just reduces the amount of all up code that I have to write by up to 46 percent and improves productivity by up to 55 of all the things get a copilot for business can do what it can't do is replace your role as a software creator if you want to start playing around with copilot you can check out that URL on the screen which will bring you to a curated environment where you can explore the magic of GitHub co-pilot for yourself
Info
Channel: GitHub
Views: 47,504
Rating: undefined out of 5
Keywords: security, github, devops, owasp, codeql, git, git and github, gitHub tutorial, how to use github, github for beginners, code, coding, programming, developer, software, visual studio code, microsoft github, github copilot, github copilot demo, github copilot x, github copilot tutorial, github development, github copilot voice chat, coding with copilot, django app in python, web api app in c#, intelliasense, chatgpt, can github copilot replace developers, copilot, copilot 365, copilot vscode
Id: kgHms6mLqGg
Channel Id: undefined
Length: 10min 19sec (619 seconds)
Published: Mon May 22 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.