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.

Refactoring: Final steps

Refactoring: Final steps

From the course: Agile Software Development: Refactoring

Start my 1-month free trial

Refactoring: Final steps

- [Instructor] I've gone ahead and added handlers for each of the item types. I've included a copy of my code, so you can begin at the same point as me. And notice how much simpler update quality looks already. It's very easy to read, it's easy to see what happens if it's a normal item, what happens if it's aged pre, and so on. And there are still a couple of improvements we can make here. Now I think that all of the code in the final else clause, starting at line 29, is superfluous. I think that all of the if and else if statements from lines 21 through 27 handle everything for normal items and special items. So let's see if we can simplify this by deleting all of these lines of code in the final else clause. Let's do that right now. I'll mark all of the lines from 29 through 81. Delete all of that and run the tests. The tests are all agreeing. So it turns out that all of that code was superfluous. We didn't need it. Now if we look at update quality, wow, now it's starting to look…

Contents