Article summary
When I took my first programming course, I was instructed to write code using a basic text editor. Since this was my introduction to software development, I did as I was told and wrote a lot of boilerplate Java. In my next course, the size and scope of my first project vastly exceeded anything I had done before. Unfortunately, I did not know any other way to program and wrote the whole application in a basic text editor. When I finally demoed my work to classmates, I was met with a combination of horror, amusement, and shock.
Luckily, someone was kind enough to show me Eclipse, and it blew my mind. Working in an integrated development environment (IDE) completely shifted my mental model of how long it would take to write code. Over the years I’ve learned plenty of new technologies and tools that have increased my productivity. But, I hadn’t experienced a jump like that until a coworker introduced me to Copilot. Here are my thoughts on how to get the most out of Copilot.
Focus on the why.
Although what Copilot offers is impressive, I don’t think it will do all of your work for you. Contrary to what people may think, writing code is actually the easiest part of being a developer. The real challenge is figuring out what you should be building and why you are being asked to build it.
Even though writing the code isn’t always the hardest part of the job, it takes up much of your time. Of course, you could speed this up with years of practice and lots of fancy keyboard shortcuts, but it can take years to get to that point. On top of actually writing the code, it’s a challenge to stay on top of the syntax changes from one language to another, and it might involve more than one Google search. Copilot will save you time by taking care of the how, leaving you to focus on the what and the why.
Refactor quickly.
Writing new code is not the only area where Copilot shines. It’s also extremely useful when it comes to refactoring. Using Copilot’s modify feature (summed up nicely here) lets you quickly make changes to large code chunks. From changing the format of strings and variables to reducing complicated logic, you can coax Copilot into modifying your code in many different ways. Once I get a method working the way I expect, I frequently let Copilot simplify it. While I don’t think computers can think, I’ll be the first to admit they are far superior to me at reading logic expressions.
It’s a good thing you have tests.
Now I’m not saying Copilot is flawless. It’s more than happy to spit out a lot of obviously incorrect code occasionally. On top of that, it can generate some subtly incorrect code, which is even worse. Luckily we already have the tools for tackling that problem: tests. When a good test suite is set up for a project, you can validate any code generated for you easily. Testing allows you to get the most out of Copilot, allowing you to refactor or generate large blocks of code knowing your tests will catch anything that might slip past your review.
Copilot may not be ready to replace developers, but it can make our jobs much easier. If you aren’t already using code generation tools, I suggest you give them a try. You’ll find yourself spending less time writing code and more time building software.