This is a series of blog posts going through the great book Growing Object Oriented Software Guided By Tests, typing in code chapter by chapter, trying to add some of my own understanding where things may not be easy to grasp in the book. I highly recommand you get a copy of the book and follow along with me. Happy coding.
It’s all about refactoring this time!
Main, we see some places
messages. But it lacks a language here. After some thoughts, we think we really mean bid in auction and join auction. Now it sounds like we should put these functions into the
Auction can bid and join.
2. Extracting the User Interface
SniperListener, to handle UI events. We can create a new class to take over that resposibility. We call it
SniperStateDisplayer. This is a inner class, so not a big change.
3. Tidying Up the Translator
Not much to say about this, just clean up the string parsing code. One thing though, the author do care a lot about the flow of the code, it has to read like a sentence.
This marks the end of Chapter 13.