Head_First_-_Design_Patterns_softprovn.net - x Intro Your...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: x Intro Your brain on Design Patterns. Here you are trying to learn something, while here your brain is doing you a favor by making sure the learning doesnt stick . Your brains thinking, Better leave room for more important things, like which wild animals to avoid and whether naked snowboarding is a bad idea. So how do you trick your brain into thinking that your life depends on knowing Design Patterns? Who is this book for? xxvi We know what your brain is thinking xxvii Metacognition xxix Bend your brain into submission xxxi Technical reviewers xxxiv Acknowledgements xxxv Table of Contents (summary) Intro xxv 1 Welcome to Design Patterns: an introduction 1 2 Keeping your Objects in the know: the Observer Pattern 37 3 Decorating Objects: the Decorator Pattern 79 4 Baking with OO goodness: the Factory Pattern 109 5 One of a Kind Objects: the Singleton Pattern 169 6 Encapsulating Invocation: the Command Pattern 191 7 Being Adaptive: the Adapter and Facade Patterns 235 8 Encapsulating Algorithms: theTemplate Method Pattern 275 9 Well-managed Collections: the Iterator and Composite Patterns 315 10 The State of Things: the State Pattern 385 11 Controlling Object Access: the Proxy Pattern 429 12 Patterns of Patterns: Compound Patterns 499 13 Patterns in the Real World: Better Living with Patterns 577 14 Appendix: Leftover Patterns 611 Table of Contents (the real thing) table of contents xi 1 Welcome to Design Patterns Someone has already solved your problems. In this chapter, youll learn why (and how) you can exploit the wisdom and lessons learned by other developers whove been down the same design problem road and survived the trip. Before were done, well look at the use and beneFts of design patterns, look at some key OO design principles, and walk through an example of how one pattern works. The best way to use patterns is to load your brain with them and then recognize places in your designs and existing applications where you can apply them . Instead of code reuse, with patterns you get experience reuse. intro to Design Patterns Your BRAIN Your Code, now new and improved with design patterns! A B u n c h o f P a t e r s swim() display () performQuack() performFly() setFlyBehavior() setQuackBehavior() / OTHER duck-like methods. Duck FlyBehavior flyBehavior; QuackBehavior quackBehavior; < interface> FlyBehavior fly() fly() { / implements duck flying } FlyWithWings / do nothing - cant fly! FlyNoWay QuackBehavior quack() quack) { / implements duck quacking Quack quack() { / rub er duckie squeak Squeak / do nothing - cant quack! MuteQuack display() { / lo ks like a decoy duck } Decoy Duck / lo ks like a mal ard } Mal ard Duck / lo ks like a redhead } Redhead Duck / lo ks like a rub erduck } Rub er Duck Encapsulated y behavior Encapsulated quack behavior Client V iew C ontrol er Model Request MVC S ubjec t Obje ct 8 int D o g O b ject M o u s e O b ject C a t O b j e ct D u c k O O b s e r v e r s Automatic update/notification...
View Full Document

Page1 / 691

Head_First_-_Design_Patterns_softprovn.net - x Intro Your...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online