O'Reilly logo

Scala Test-Driven Development by Gaurav Sood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Refactor Mercilessly

Refactoring your code is a continuous process. It should not be limited to just the application code. In this chapter we will cover:

  • Clean code
  • Red-Green-Refactor
  • Code smell
  • To refactor or not to refactor?
  • Refactoring techniques
  • Building reusable test code

Clean code

We have been harping on about clean code for a while now. Let's take a moment to define what exactly clean code is.

Very simply put, clean code is simple code: no gimmicks, no short cuts, and easy to understand. It should pass all the tests and should not have any duplication. It contains the minimum number of moving parts.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required