From the course: Accelerate DevOps and Software Development with AI: Modern Tools and Workflows for Enhanced Software Delivery
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Coding project: Refactor Python code with AI
From the course: Accelerate DevOps and Software Development with AI: Modern Tools and Workflows for Enhanced Software Delivery
Coding project: Refactor Python code with AI
- Now, let's see how AI helps with refactoring. Refactoring is about cleaning code without changing behavior. I'll highlight the sorting function in the list books method and use a prompt that says to refactor list books. So the sorting functionality is moved into a helper function. Keep behavior identical. Okay, so I like that it's broken. It steps down into a checklist, and the last step is actually the most important step because that's where we're going to verify if the behavior remains the same after refactoring. So it has a suggestion, I'm going to accept it. Okay, now it's saying we can run the test_book_service file. So we'll try that. Okay. It's running into some issues. It's going to try running it this time with Python 3. Okay. It can't find a module. Okay. It's saying that there's some issues with the Python version compatibility. So it's going to check what version of Python we're running right now.…
Contents
-
-
-
-
(Locked)
What powers GitHub Copilot and ChatGPT?4m 20s
-
(Locked)
Prompt engineering for developers2m 38s
-
(Locked)
Role-based prompting for better code reviews2m 31s
-
Iterative prompting to guide AI to better code3m 35s
-
(Locked)
Coding project: Plan and test with AI tools1m 59s
-
(Locked)
Coding project: Speed up Python coding with smart prompts2m 26s
-
(Locked)
Coding project: Create AI-assisted test cases in Python2m 31s
-
(Locked)
Coding project: AI-powered docstrings for developers2m 18s
-
(Locked)
Coding project: Review Python code with AI1m 55s
-
(Locked)
Coding project: Navigating code with AI59s
-
(Locked)
Coding project: Refactor Python code with AI4m 6s
-
(Locked)
Case studies: AI wins and fails4m 22s
-
(Locked)
-
-
-