-
Book Overview & Buying
-
Table Of Contents
Supercharged Coding with GenAI
By :
Before you proceed to the next chapter, make sure that you can confidently answer the following questions:
Question 1: Why do we need GenAI for refactoring tasks if IDEs already provide built-in tools?
Answer: While built-in tools are powerful, they have limitations. For example, they can only extract code blocks to external functions when the lines are written consecutively in a single block. GenAI allows us to restructure Python objects more flexibly, using the CoT technique with the original implementation as a reference.
Question 2: How does the CoT approach differ when refactoring existing code compared to generating new code?
Answer: When generating new code, we typically describe the high-level function we want GenAI to complete. For refactoring, we also include the original implementation in the prompt. This helps GenAI understand the intended functionality, such as parsing specific JSON request keys or assigning them to specific variable names.
...