CHAPTER 8Code Refactoring with Copilot
In this chapter, you will learn how to use Copilot as a refactoring pair-programming assistant. While code refactoring tools such as VS Code language services and JetBrains ReSharper help you make safe refactors for your code, you can use Copilot as a pair programmer in your refactoring efforts. Copilot can assist you in exploring better ways to write your code and even assist you when making changes. You can download a copy of the starter project todo-api-ch08-starter in the Chapter 8 folder.
www.wiley.com/go/programminggithubcopilot
- Introducing Code Refactoring with Copilot
- Establishing the Example Project
- Refactoring Duplicate Code
- Refactoring Validators
- Refactoring Bad Variable Names
- Documenting and Commenting Code
Introducing Code Refactoring with Copilot
Code refactoring is the process of modifying internal code without changing its external behavior. Before you begin refactoring code, you must have a test suite that covers your code to ensure that you do not modify your external behavior.
The goal in code refactoring is to increase the maintainability of your code and enhance its extensibility. Maintainable code is easy to understand, navigate, and modify. Extensible code is flexible and adaptable to the needs of your application as it advances over time.
You have seen how Copilot can assist you in creating new tests, functions, classes, and even entire program templates. We have not yet explored how Copilot can assist you in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access