Github Copilot - The Good and the BAD
Published: 2021-07-14 07:39:57

I have been trying to generate code with the help of GPT3 from few months now and recently got access to a better product called **Github copilot**. 

 [**Github Copilot**](https://copilot.github.com/)  is an VS Code extension which can autocomplete your code and also synthesize code by seeing your comments and function name. This is built using the same model and trained on billions of public code.

![gpt3copilot.JPG](https://cdn.hashnode.com/res/hashnode/image/upload/v1625455957844/-90gokQHv.jpeg)



When I told my friends about Github Copilot  the first question I got is
> Can it do DSA Problems and help me crack into FAANG xD?

This was funny but I wanted to try it out and the results were mind blowing. AI could solve most of the DSA problems and I have shared some results  [here ](https://richurl.tech/dsacopilot) .

Later I tried using github copilot in some real development work like writing email validation , making api calls to github and even building a simple email sending client.

Now I have some clear idea on the limitations and things that Copilot is good at this movement .

Before moving on to the article if you prefer videos over an article, Here is my video on  [Solving DSA Problems using Github Copilot](https://www.youtube.com/watch?v=9Pw-Roo_duE) 

 [![copilot.jpg](https://cdn.hashnode.com/res/hashnode/image/upload/v1625455007755/XNtYm-8jT.jpeg)](https://www.youtube.com/watch?v=9Pw-Roo_duE) 

## The Good✨

### Forgot the Syntax ? No worries. AI got your back

When building a project I had forgot status code for what response to send and writing a comment about it gave me a result. Also I had written python after long time and at one point I had forgot the syntax for slicing and this helped me there aswell.

### Can help you with Email Validation and API Calls

As I shared before it was really easy to **generate simple functions**  for calling some  [API's and write some regex code](https://richurl.tech/8bRT4sxX6)  without learning it or depending on **documentation**. ( Not recommended if you are a beginner) . 

### Bioler Plate code

![vlcsnap-2021-07-05-09h06m42s448.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625456225356/0uYrXfTAj.png)
It can also help you get like a boiler plate code for express and helped me write some mongo schemes aswell .

> Overall I just love how seamlessly  Github Copilot can show you suggestions on vs code. Beautifully done

---
## Limitations 🙃

Github Copilot for an first generation/ Beta product is way too good. But there are a lot of biased articles online so I just wanted to show the other side aswell.

### Doesn't Follow the Best Practices

The code synthesized doesn't always follow the best practices or is not optimized to use it for backend development. Like in Javascript, it generates **var** and **==** than **const **and **===** which can lead to different bugs and shadowing.

Checkout my article on  [best practices for JS developers](https://blog.hrithwik.me/10-best-javascript-practices-recommended-by-top-developers) 

### Version Conflicts

Some Code Generated might not work for the version your codebase is on and can lead to conflicts. Also sometimes AI can give out a lot of unnecessary code. Developers with experience can definitely handle this out but what if a newbie directly starts with the help of AI, he will spend more time on stack overflow than writing actual code. ( oh wait that's how most of the developers are lmao)

### Weird Copyright messages

![Creating an actual project using Github Copilot.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625456179507/n5Oyz_WBL.png)
When I tried to generate code for converting linkedlist into a tree which is like a famous DS problem I started AI started showing a Copyrighted code and it was from a person called Stephen. 


> Hey Stephen, If you are reading this, please follow me on hashnode .

---

## Frequently asked Questions 

- What's Good ? 

> It's great if you want to create functions like email validation or user schema or API request since it has enough data but again some code might not really be efficient.

- Can it help you crack DSA Problems **(if it is legal)** ? 

> The Answer is not  binary. it can help you give building blocks according to your needs and you are the one who should build the building.

- Will it Replace Humans ?

>Absolutely NOT. As the name suggests ,  it's  a copilot making your life easier. You are the pilot who can understand human narratives and stories to build product from code.

### Let's Connect 

Thanks for reading my article. I want to make new friends in the dev world. Let's connect on  [Twitter](twitter.com/hrithwik_) and [LinkedIn ](https://www.linkedin.com/in/hrithwik-bharadwaj) .

Also a tiny Observation

> After using this to write my project code for more than 2 hours I got so used to copilot that without using github copilot suggestion I literally didn't know what to write next in my code . I am a little scared. IT's a TRAP to make developers even lazy xD . Can't wait to see the pricing.