Head First Design Patterns Chapter 9 exercise