Summary
In this chapter, we explored how GitHub Copilot, ChatGPT, and OpenAI API can assist in rewriting code while preserving its original functionality. These tools can enhance readability, improve structure, and boost performance.
Clean code is a shared goal among software developers, especially as projects grow and become complex. Most IDEs already offer strong built-in tools for refactoring, which we frequently use. However, when those tools reach their limits, GenAI can step in. It can support structural refactoring by using CoT techniques with the original implementation, or it can optimize performance through the five S’s framework.
Although refactoring is useful, writing clean and structured code from the start is usually simpler. In the next chapter, we will introduce fine-tuning with OpenAI API as an alternative to few-shot learning. Fine-tuning enables us to adapt a pretrained model to a specific domain, such as generating clean and well-organized code....