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.
Refactor to improve the design - Java Tutorial
From the course: Programming Foundations: Test-Driven Development
Refactor to improve the design
- [Instructor] In the red green refactor cycle, the goal of refactoring is to make your code easy to read and cheaper to modify. However, you do not refactor every time you write new test case or new code. It is an optional step whenever you notice that you are duplicating your code or your code is becoming redundant, hard to read or your code just doesn't feel right. Also there is no rule that says you should refactor after every five test cases or every 15 minutes. Developers come up with their own time rules based on the complexity of what they are making and how confident they feel about it. Some say they refactor every one hour of coding. Others say you should refactor when you find yourself repeating some code the third time. I refactor when I find myself getting confused, reading my own code or taking too long to add a new functionality. Writing test cases and making them pass should be short and quick a matter of…
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.