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

Micro-refactoring

From the course: Agile Software Development: Refactoring

Start my 1-month free trial

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…

Contents