Cover by Eric Freeman, Elisabeth Robson, Bert Bates, Kathy Sierra

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Chapter 13. Better Living with Patterns: Patterns in the Real World

image with no caption

Ahhhh, now you’re ready for a bright new world filled with Design Patterns. But, before you go opening all those new doors of opportunity, we need to cover a few details that you’ll encounter out in the real world – that’s right, things get a little more complex than they are here in Objectville. Come along, we’ve got a nice guide to help you through the transition on the next page...

image with no caption

Design Pattern defined

We bet you’ve got a pretty good idea of what a pattern is after reading this book. But we’ve never really given a definition for a Design Pattern. Well, you might be a bit surprised by the definition that is in common use:

Note

A Pattern is a solution to a problem in a context.

That’s not the most revealing definition is it? But don’t worry, we’re going to step through each of these parts, context, problem and solution:

  • The context is the situation in which the pattern applies. This should be a recurring situation.

    Note

    Example: You have a collection of objects.

  • The problem refers to the goal you are trying to achieve in this context, but it also refers to any constraints that occur in the context.

    Note

    You need to step through the objects without exposing the collection’s implementation.

  • The solution is what you’re after: a ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required