From the course: Programming Foundations: Test-Driven Development
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
The iterative red-green-refactor cycle - Java Tutorial
From the course: Programming Foundations: Test-Driven Development
The iterative red-green-refactor cycle
- After writing test cases and then writing code, you begin to see the low-level design emerge, but for this design to be really a good one, you need to take the third and a very important step: refactoring. When you change your code to improve its readability or maintainability without changing its functionality, then you are refactoring it, and refactoring becomes very easy in TDD because you always have the suite of test cases to make sure you're not breaking anything when making those changes. Let us see how our hangman team goes about it. - So it seems to me that our code is not very efficient when it comes to fetching the word. - Why? - Well, first of all, every time that we invoke the fetchWord method, we're opening and closing the word source file, and we should just do that one time and load all the words somewhere. - Yeah, you're right. We can store all the words in an array list. - Now, I also think…
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.