Paulund

What I Use GitHub Copilot For

Github Copilot was the first tool that introduced me to the power of what AI can do to help us with our day-to-day tasks. I've been using it for a while now and I've found it to be a great tool for generating code snippets, especially when I'm working on a new project or trying to solve a problem that I'm not familiar with.

It currently costs $10/month, but I think it's worth it. I'm going to go over how I use it and how I get the value out of it.

Understanding Existing Code

When you're starting work on a old project that you may not be familiar with, Copilot can help you understand the codebase by being able to explain bits of the code to you. I'm sure we've all worked on legacy systems that might have complicated code in the project and the developer that wrote it may not be at the company anymore. Copilot can help you understand what the code is doing and how it's doing it. You can do this by going into the file and using the /explain command.

This is a fast way of understanding what the code is doing so you can work on improving it. The code may have been written in older code which might not have the newer features we have today.

Along with explaining the code to you Copilot can be used to simplify that code for you, just by using the /simplify command. This will try to refactor the code to make it easier to understand. It could also be used to resolve bugs that may be in the existing code base.

If you work on legacy system often this is a great tool for you. Now that Copilot chat is integrated in the IDE it makes it even easier to use this as you can ask follow up questions to the /explain or the /simplify command.

Documentation

Copilot can also make it really easy to document your code. It can generate comments for you, which can be really helpful when you're working on a new project or when you're working on a project with a team.

In this explain I'm thinking of docblocks that will be used for any documentation generation tool that you're using. Copilot can generate the docblocks for you and you can fill in the details. This can save you a lot of time when you're working on a project.

Improving your code

Along with working on legacy code I use this a lot to clean up my solutions, say I've finished a feature I will ask Copilot if what I've done can be improved in a simpler way. I'm a great believer in the simplest approach is the best approach when working with software. Copilot can help you with this by suggesting a simpler way to do what you've done. It will also suggest how this can be refactored and explain the refactor to me so I can remember for next time.

Boilerplate code

I use to use IDE templates a lot when working on new files but now I tend to get autocomplete suggestions from Copilot when boilerplating a new file.

For example if I'm creating a new file for tests, Copilot will be able to auto fill the namespace, the class name, the extending Class and even make suggests for what I need to test.

This is a great time saver as I don't need to write this basic code all the time I can just let Copilot do that for me.

IDE Integration

I mainly use PHPStorm for my development and the integration is slightly behind that of VSCode but it's still very useful. I can ask Copilot to explain code to me, simplify code, generate comments and even generate code snippets.

In VSCode you can use Copilot to make suggests to code commits and pull request descriptions etc but I hope those features will come to PHPStorm soon.

Conclusion

I find that Copilot is a great time saver for me and will continue to use it in the future as it does help speed up my development. This is where I feel AI is going to be used by developers in the future. I don't think software engineers will be replaced by AI but I think we will be able to use AI to help us with our day-to-day tasks. I do agree that engineers that are not using AI will fall behind those that are using it, this is because of the time saving that AI can bring to us.

UpChecker

Reliable uptime monitoring and instant alerts for any website downtime.

  • Uptime Monitoring
  • Performance Monitoring
  • SSL Certificate Alerts
  • Domain Monitoring
  • DNS Checker
  • XML Sitemap Monitoring