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: Extract Method

Refactoring: Extract Method

From the course: Agile Software Development: Refactoring

Start my 1-month free trial

Refactoring: Extract Method

- [Instructor] Okay, we have a failing test case. We're at the red step of the red-green refactor test driven development three step dance. Let's write the least amount of code to make this go green. Again, this is a naive solution. This is the least amount of code. As we're doing a code kata, the goal is to practice the moves. So we're practicing the move of writing the least amount of code to make that new red test go green. At line nine, we'll add this code, else if romanNumeral.equals VI. Then, return six. In line 11, add the else if there. Rerun the tests. Notice that it's green. So we've done red, we had a test that failed. We've written the least amount of code to make it pass, we're green. Now, let's take a look at the code. I'm noticing something about this code. This is too long, this method is too long to fit on the screen. The title of the method has scrolled off the top of the screen. I can't see the bottom of the method. It's scrolled off the bottom of the editor. It's…

Contents