;Praise for Head First Design Patterns;More Praise for Head First Design Patterns;Praise for other books by Eric Freeman and Elisabeth Robson;Authors of Head First Design Patterns;Creators of the Head First series (and co-conspirators on this book);How to Use This Book: Intro; Who is this book for?; We know what you''re thinking.; And we know what your brain is thinking.; Metacognition: thinking about thinking; Here''s what WE did; Here''s what YOU can do to bend your brain into submission; Read Me; Tech Reviewers; Acknowledgments; Even more peopleThe large number of acknowledgments is because we''re testing the theory that everyone mentioned in a book acknowledgment will buy at least one copy, probably more, what with relatives and everything. If you''d like to be in the acknowledgment of our next book, and you have a large family, write to us.;Chapter 1: Intro to Design Patterns: Welcome to Design Patterns; 1.1 It started with a simple SimUDuck app; 1.2 But now we need the ducks to FLY; 1.3 But something went horribly wrong.
; 1.4 Joe thinks about inheritance.; 1.5 How about an interface?; 1.6 What would you do if you were Joe?; 1.7 The one constant in software development; 1.8 Zeroing in on the problem.; 1.
9 Separating what changes from what stays the same; 1.10 Designing the Duck Behaviors; 1.11 Implementing the Duck Behaviors; 1.12 Integrating the Duck Behavior; 1.13 More integration.; 1.14 Testing the Duck code; 1.15 Setting behavior dynamically; 1.
16 The Big Picture on encapsulated behaviors; 1.17 HAS-A can be better than IS-A; 1.18 Speaking of Design Patterns.; 1.19 Overheard at the local diner.; 1.20 Overheard in the next cubicle.; 1.
21 The power of a shared pattern vocabulary; 1.22 How do I use Design Patterns?; 1.23 Tools for your Design Toolbox;Chapter 2: The Observer Pattern: Keeping your Objects in the know; 2.1 The Weather Monitoring application overview; 2.2 Unpacking the WeatherData class; 2.3 What do we know so far?; 2.4 Taking a first, misguided SWAG at the Weather Station; 2.5 What''s wrong with our implementation?; 2.
6 Meet the Observer Pattern; 2.7 Publishers + Subscribers = Observer Pattern; 2.8 A day in the life of the Observer Pattern; 2.9 Five-minute drama: a subject for observation; 2.10 Two weeks later.; 2.11 The Observer Pattern defined; 2.12 The Observer Pattern defined: the class diagram; 2.
13 The power of Loose Coupling; 2.14 Cubicle conversation; 2.15 Designing the Weather Station; 2.16 Implementing the Weather Station; 2.17 Implementing the Subject interface in WeatherData; 2.18 Now, let''s build those display elements; 2.19 Power up the Weather Station; 2.20 Using Java''s built-in Observer Pattern; 2.
21 How Java''s built-in Observer Pattern works; 2.22 Reworking the Weather Station with the built-in support; 2.23 Running the new code; 2.24 The dark side of java.util.Observable; 2.25 Other places you''ll find the Observer Pattern in the JDK; 2.26 And the code.
; 2.27 Tools for your Design Toolbox;Chapter 3: The Decorator Pattern: Decorating Objects; 3.1 Welcome to Starbuzz Coffee; 3.2 The Open-Closed Principle; 3.3 Meet the Decorator Pattern; 3.4 Constructing a drink order with Decorators; 3.5 The Decorator Pattern defined; 3.6 Decorating our Beverages; 3.
7 Cubicle Conversation; 3.8 New barista training; 3.9 Writing the Starbuzz code; 3.10 Coding beverages; 3.11 Coding condiments; 3.12 Serving some coffees; 3.13 Real World Decorators: Java I/O; 3.14 Decorating the java.
io classes; 3.15 Writing your own Java I/O Decorator; 3.16 Test out your new Java I/O Decorator; 3.17 Tools for your Design Toolbox;Chapter 4: The Factory Pattern: Baking with OO Goodness; 4.1 Identifying the aspects that vary; 4.2 But the pressure is on to add more pizza types; 4.3 Encapsulating object creation; 4.4 Building a simple pizza factory; 4.
5 Reworking the PizzaStore class; 4.6 The Simple Factory defined; 4.7 Franchising the pizza store; 4.8 A framework for the pizza store; 4.9 Allowing the subclasses to decide; 4.10 Let''s make a PizzaStore; 4.11 Declaring a factory method; 4.12 We''re just missing one thing: PIZZA!; 4.
13 You''ve waited long enough. Time for some pizzas!; 4.14 It''s finally time to meet the Factory Method Pattern; 4.15 Another perspective: parallel class hierarchies; 4.16 Factory Method Pattern defined; 4.17 A very dependent PizzaStore; 4.18 Looking at object dependencies; 4.19 The Dependency Inversion Principle; 4.
20 Applying the Principle; 4.21 Inverting your thinking.; 4.22 A few guidelines to help you follow the Principle.; 4.23 Meanwhile, back at the PizzaStore.; 4.24 Families of ingredients.
; 4.25 Building the ingredient factories; 4.26 Building the New York ingredient factory; 4.27 Reworking the pizzas.; 4.28 Reworking the pizzas, continued.; 4.29 Revisiting our pizza stores; 4.
30 What have we done?; 4.31 More pizza for Ethan and Joel.; 4.32 Abstract Factory Pattern defined; 4.33 Factory Method and Abstract Factory compared; 4.34 Tools for your Design Toolbox; 4.35 A very dependent PizzaStore;Chapter 5: The Singleton Pattern: One of a Kind Objects; 5.1 The Little Singleton; 5.
2 Dissecting the classic Singleton Pattern implementation; 5.3 The Chocolate Factory; 5.4 Singleton Pattern defined; 5.5 Houston, Hershey, PA we have a problem.; 5.6 Dealing with multithreading; 5.7 Can we improve multithreading?; 5.8 Meanwhile, back at the Chocolate Factory.
; 5.9 Congratulations!; 5.10 Tools for your Design Toolbox;Chapter 6: The Command Pattern: Encapsulating Invocation; 6.1 Free hardware! Let''s check out the Remote Control.; 6.2 Taking a look at the vendor classes; 6.3 Cubicle Conversation; 6.4 Meanwhile, back at the Diner.
, or, A brief introduction to the Command Pattern; 6.5 Let''s study the interaction in a little more detail.; 6.6 The Objectville Diner roles and responsibilities; 6.7 From the Diner to the Command Pattern; 6.8 Our first command object; 6.9 Using the command object; 6.10 Creating a simple test to use the Remote Control; 6.
11 The Command Pattern defined; 6.12 The Command Pattern defined: the class diagram; 6.13 Assigning Commands to slots; 6.14 Implementing the Remote Control; 6.15 Implementing the Commands; 6.16 Putting the Remote Control through its paces; 6.17 Time to write that documentation.; 6.
18 What are we doing?; 6.19 Time to QA that Undo button!; 6.20 Using state to implement Undo; 6.21 Adding Undo to the CeilingFan commands; 6.22 Get ready to test the ceiling fan; 6.23 Testing the ceiling fan.; 6.24 Every remote needs a Party Mode!; 6.
25 Using a macro command; 6.26 The Command Pattern means lots of command classes; 6.27 Simplifying the Remote Control with lambda expressions; 6.28 Simplifying even more with method references; 6.29 Test the remote control with lambda expressions; 6.30 More uses of the Command Pattern: queuing requests; 6.31 More uses of the Command Pattern: logging requests; 6.32 Tools for your Design Toolbox;Chapter 7: The Adapter and Facade Patterns: Being Adaptive; 7.
1 Adapters all around us; 7.2 Object-oriented adapters; 7.3 If it walks like a duck and quacks like a duck, then it must might be a duck turkey wrapped with a duck adapter.; 7.4 Test drive the adapter; 7.5 The Adapter Pattern explained; 7.6 Adapter Pattern defined; 7.7 Object and class adapters; 7.
8 Real-world adapters; 7.9 Adapting an Enumeration to an Iterator; 7.10 And now for something different.; 7.11 Home Sweet Home Theater; 7.12 Watching a movie (the hard way); 7.13 Lights, Camera, Facade!; 7.14 Constructing your home theater facade; 7.
15 Implementing the simplified interface; 7.16 Time to watch a movie (the easy way); 7.17 Facade Pattern defined; 7.18 The Principle of Least Knowledge; 7.19 How NOT to Win Friends and Influence Objects; 7.20 The Facade and the Principle of Least Knowledge; 7.21 Tools for your Design Toolbox;Chapter 8: The Template Method Pattern: Encapsulating Algorithms; 8.1 It''s time for some more caffeine; 8.
2 Whipping up some coffee and tea classes (in Java); 8.3 And now the Tea.; 8.4 Sir, may I abstract your Coffee, Tea?; 8.5 Taking the design further.; 8.6 Abstracting prepareRecipe(); 8.7 What have we done?; 8.
8 Meet the Template Method; 8.9 Let''s make some tea.; 8.10 What did the Template Method get us?; 8.11 Template Method Pattern defined; 8.12 Hooked on Template Method.; 8.13 Using the hook; 8.
14 Let''s run the Test Drive; 8.15 The Hollywood Principle; 8.16 The Hollywood Principle and Template Method; 8.17 Template Methods in the Wild; 8.18 Sorting with Template Method; 8.19 We''ve got some ducks to sort.; 8.20 What is compareTo()?; 8.
21 Comparing Ducks and Ducks; 8.22 Let''s sort some Ducks; 8.23 The making of the sorting duck machine; 8.24 Swingin'' with Frames; 8.25 Applets; 8.26 Tools for your Design Toolbox;Chapter 9: The Iterator and Composite Patterns: Well-Managed Collections; 9.1 Breaking News: Objectville Diner and Objectville Pancake House Merge; 9.2 Check out the Menu Items; 9.
3 Lou and Mel''s Menu implementations; 9.4 What''s the problem with having two different menu representations?; 9.5 What now?; 9.6 Can we encapsulate the iteration?; 9.7 Meet the Iterator Pattern; 9.8 Adding an Iterator to DinerMenu; 9.9 Reworking the Diner Menu with Iterator; 9.10 Fixing up the Waitress code; 9.
11 Testing our code; 9.12 What have we done so far?; 9.13 What we have so far.; 9.14 Making some improvements.; 9.15 Cleaning things up with java.util.
Iterator; 9.16 We are almost there.; 9.17 What does this get us?; 9.18 Iterator Pattern defined; 9.19 Single Responsibility; 9.20 Taking a look at the Café Menu; 9.21 Reworking the Café Menu code; 9.
22 Adding the Café Menu to the Waitress; 9.23 Breakfast, lunch AND dinner; 9.24 What did we do?; 9.25 We decoupled the Waitress.; 9.26 . and we made the Waitress more extensible; 9.27 But there''s more!; 9.
28 Iterators and Collections; 9.29 Is the Waitress ready for prime time?; 9.30 Just when we thought it was safe.; 9.31 What do we.