Java Design Patterns: Proven Solutions to Common Problems

Design patterns have two major benefits. First, they provide proven solutions to common development issues. Each solution facilitates the development of highly cohesive modules with minimal coupling. Design patterns make the overall system easier to understand and maintain. Second, they make communication between developers and designers more efficient.

In general, patterns have four essential elements.
The pattern name is a handle developers can use to describe -- in a word or two -- a design problem, its consequences and its solutions. Naming a pattern immediately increases developers' design vocabulary, allowing them to design at a higher level of abstraction. Having a vocabulary for patterns also makes it easier to think about designs and to communicate them and their trade-offs to others. However, finding good names is one of the hardest parts of developing the design pattern catalog.

The problem defines the design problem and its context, and describes when to apply the pattern to it. It might describe specific design problems such as how to represent algorithms as objects. It might describe class or object structures that are symptomatic of an inflexible design. Sometimes the problem will include a list of conditions that must be met before it makes sense to apply the pattern.

The solution defines the elements that make up the design: their relationships, responsibilities, and collaborations. The solution doesn't describe a particular concrete design or implementation, because a pattern is like a template that can be applied in many different situations. Instead, the pattern provides an abstract description of a design problem and how a general arrangement of elements (classes and objects in this case) solves it.

The consequences are the results and trade-offs of applying the pattern. Though consequences are often unvoiced when developers describe design decisions, they are critical for evaluating design alternatives and for understanding the costs and benefits of applying the pattern. The consequences for software often concern space and time trade-offs. They may address language and implementation issues as well. Because reuse is often a factor in object-oriented design, the consequences of a pattern include its impact on a system's flexibility, extensibility, or portability. Listing these consequences explicitly helps you understand and evaluate them.

Click for Complete Article


Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email