From the course: Agile Software Development: Refactoring
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Micro-refactoring
From the course: Agile Software Development: Refactoring
Micro-refactoring
- [Teacher] As I'm looking at this code I'm noticing something else we can improve. The new method is in the test class, as if it were part of the test code. In fact it's part of the solution, so we want it to be in a separate class. Also we'd want that class to be in the main area of the source code instead of the test area of the source code. So what we're going to do is a series of refactorings. Sometimes a refactoring is large. Now large refactorings are risky. We might introduce new defects with a very large refactoring. So instead of doing a single large refactoring, we'll do a series of smaller micro-refactorings. And after each micro-refactoring, we'll re-run the tests to make sure we didn't change any of the external behavior. The first micro-refactoring we'll try is to move the convert method to it's own class. We'll right click on convert, click re-factor, and move. Now IntelliJ suggests that to be able to move this to it's own class, first we should make it static. So this…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
What is refactoring?53s
-
(Locked)
Test-driven development (TDD)1m 10s
-
(Locked)
Code kata1m 24s
-
(Locked)
Setting up the new code kata2m 30s
-
(Locked)
Setting up the TDD environment3m 13s
-
(Locked)
Refactoring: Rename Variable3m 47s
-
(Locked)
Micro-refactoring3m 47s
-
Refactoring: Inline Code4m 3s
-
(Locked)
Code kata: Continue solving the problem4m 2s
-
(Locked)
Refactoring: Extract Method4m 38s
-
(Locked)
-
-
-