Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 6. Light States > Refactoring

Refactoring

At this point we could move on to the next implementation function and the next examples. But we’re certainly not done yet. There are two flaws that I am unhappy with, and we should be responsible for cleaning up the mess we made. In addition, moving on without correcting the flaws would not make much sense.

First, we implemented everything in the source class that shall glue together the production code and the tests. So, in order to be really finished, we need to peel this code out into a new class or concept of our production code. Ideally, we do this using test-driven development (TDD) [Bec02]. We will first write one tiny test, then execute it to see it really fails, implementing just enough to make this test pass, then refactor. Does this remind you of the cycle for the parking lot example? Exactly, but we will work on a smaller fragment of the code than we did with the specification.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint