GOOS Book Distilled Part 8

A follow through of the great book Growing Object-Oriented Software, Guided by Tests with code

1 minute read

It’s all about refactoring this time!

1. Extracting XMPPAuction In Main, we see some places chat sends 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, the Auction can bid and join.

Source code

2. Extracting the User Interface

The Main implements 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.

Source code

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.

Source code

This marks the end of Chapter 13.

comments powered by Disqus