{"id":7457,"date":"2021-07-12T14:30:00","date_gmt":"2021-07-12T18:30:00","guid":{"rendered":"https:\/\/blogs.swarthmore.edu\/its\/?p=7457"},"modified":"2021-07-12T14:27:01","modified_gmt":"2021-07-12T18:27:01","slug":"supercharged-coding-with-github-copilot","status":"publish","type":"post","link":"https:\/\/blogs.swarthmore.edu\/its\/2021\/07\/12\/supercharged-coding-with-github-copilot\/","title":{"rendered":"Supercharged Coding with GitHub Copilot"},"content":{"rendered":"\n<p>A little over a week ago, I was fortunate enough to receive an invite to try out <a rel=\"noreferrer noopener nofollow\" href=\"https:\/\/copilot.github.com\/\" target=\"_blank\">GitHub Copilot<\/a>. I&#8217;ve read articles and watched some YouTube videos about the tech prior to receiving my invite, and was excited to see if it lives up to the hype.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is Copilot?<\/h2>\n\n\n\n<p>Copilot is an AI pair programmer that makes suggestions in your editor as you type. These suggestions include comments, functions, variables, and more.<\/p>\n\n\n\n<p>It is powered by <a rel=\"noreferrer noopener nofollow\" href=\"https:\/\/openai.com\/\" target=\"_blank\">OpenAI Codex<\/a>, which is trained on publicly available GitHub repositories, as well as natural languages. It works via a <a rel=\"noreferrer noopener nofollow\" href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=GitHub.copilot\" target=\"_blank\">Visual Studio Code extension<\/a>. As you type in the editor, the extension talks with the Copilot web service, which then synthesizes the suggestions.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"276\" style=\"aspect-ratio: 1280 \/ 276;\" width=\"1280\" controls src=\"https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/copilot1.mov\"><\/video><figcaption><em>Copilot makes suggestions as you type. The project shown was created using create-react-app. It provides the user with a search input that will call an API to get a list of fish.<\/em><\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Coding with Copilot<\/h2>\n\n\n\n<p>After spending a week with Copilot in the passenger seat, I definitely anticipate it being an essential tool in most developer&#8217;s toolboxes.<\/p>\n\n\n\n<p>I am continually impressed with the quality of suggestions that Copilot makes. More often than not, it will suggest near-complete, boilerplate elements.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"176\" src=\"https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/Screen-Shot-2021-07-05-at-12.02.54-AM-1024x176.png\" alt=\"\" class=\"wp-image-7466\" srcset=\"https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/Screen-Shot-2021-07-05-at-12.02.54-AM-1024x176.png 1024w, https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/Screen-Shot-2021-07-05-at-12.02.54-AM-300x52.png 300w, https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/Screen-Shot-2021-07-05-at-12.02.54-AM-768x132.png 768w, https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/Screen-Shot-2021-07-05-at-12.02.54-AM-1536x265.png 1536w, https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/Screen-Shot-2021-07-05-at-12.02.54-AM-270x47.png 270w, https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/Screen-Shot-2021-07-05-at-12.02.54-AM.png 1764w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption><em>Copilot suggesting a boilerplate input element.<\/em><\/figcaption><\/figure>\n\n\n\n<p>Copilot&#8217;s training data originates from public repositories, so it&#8217;s very aware of popular libraries. This gives it the ability to make very time-saving suggestions in projects that use them.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"574\" style=\"aspect-ratio: 1912 \/ 574;\" width=\"1912\" controls src=\"https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/copilot3.mov\"><\/video><figcaption><em>Copilot generates common boilerplate nicely \u2705<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"has-black-color has-text-color\">Copilot isn&#8217;t perfect though, and it&#8217;s likely that no code-generating AI ever will be. Some suggestions may be completely wrong and break things if you aren&#8217;t careful. There&#8217;s been a number of times where Copilot suggested unneeded function calls, bad implementations of functions, or got itself caught in a cycle of endlessly providing suggestions, and never closing a function out.<\/p>\n\n\n\n<p><a href=\"https:\/\/gist.github.com\/0xabad1dea\/be18e11beb2e12433d93475d72016902\" target=\"_blank\" rel=\"noreferrer noopener\">Copilot also carries some risks associated with letting an AI write your code<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"836\" height=\"238\" src=\"https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/copilot2.png\" alt=\"\" class=\"wp-image-7475\" srcset=\"https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/copilot2.png 836w, https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/copilot2-300x85.png 300w, https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/copilot2-768x219.png 768w, https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/copilot2-211x60.png 211w\" sizes=\"auto, (max-width: 836px) 100vw, 836px\" \/><figcaption><em>Copilot suggestion. Everyone gets a valid token \u2728. At least it added a nice TODO reminder.<\/em><\/figcaption><\/figure>\n\n\n\n<p>The Copilot extension isn&#8217;t perfect either. There are times where it just seems to stop providing suggestions, and the solution (and not a good one by any means) is to close and reopen the file you were working on. Issues like this are to be expected, given the extension&#8217;s maturity.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">TLDR<\/h2>\n\n\n\n<p>All in all, I think that Copilot will become a valuable asset in every developer&#8217;s tool kit. The benefits arising from its ability to suggest boilerplate code are too great to go unnoticed. However, it is much like a double-edged sword. The developer must be aware it suggests a dangerous, deprecated, or just plain bad piece of code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A little over a week ago, I was fortunate enough to receive an invite to try out GitHub Copilot. I&#8217;ve read articles and watched some YouTube videos about the tech prior to receiving my invite, and was excited to see &hellip; <a href=\"https:\/\/blogs.swarthmore.edu\/its\/2021\/07\/12\/supercharged-coding-with-github-copilot\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Supercharged Coding with GitHub Copilot<\/span><\/a><\/p>\n","protected":false},"author":70,"featured_media":7491,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2,436,303,125],"tags":[343,306,90],"class_list":{"0":"post-7457","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","6":"hentry","7":"category-academic-technology","8":"category-artificial-intelligence-2","9":"category-development","10":"category-open-source","11":"tag-artificial-intelligence","12":"tag-development","13":"tag-featured","15":"fallback-thumbnail"},"jetpack_featured_media_url":"https:\/\/blogs.swarthmore.edu\/its\/wp-content\/uploads\/2021\/07\/githubrobot.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/ph2nPL-1Wh","_links":{"self":[{"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/posts\/7457","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/users\/70"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/comments?post=7457"}],"version-history":[{"count":30,"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/posts\/7457\/revisions"}],"predecessor-version":[{"id":7494,"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/posts\/7457\/revisions\/7494"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/media\/7491"}],"wp:attachment":[{"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/media?parent=7457"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/categories?post=7457"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.swarthmore.edu\/its\/wp-json\/wp\/v2\/tags?post=7457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}