Tuesday, October 27, 2009

Patterns Description




















Chapter 1 -
Introduction to Software Patterns
Patterns in Java, Volume 1: A Catalog of Reusable Design Patterns Illustrated with UML, Second Edition
by Mark Grand
John Wiley & Sons � 2002



























Patterns Description


Patterns are usually described using a format that includes the following information:




  • A name that is commonly used for the pattern. Alternative names are given in cases where the pattern is known by more than one name.




  • A description of the problem that includes a concrete example and a solution specific to the concrete problem.




  • A summary of the considerations that lead to the formulation of a general solution or the avoidance of the solution.




  • A general solution.




  • The consequences––good and bad––of using the given solution to solve a problem.




  • A list of related patterns.




Pattern books differ in how they present this information. The format used in this set of books varies with the phase of the software life cycle that the pattern addresses. The patterns in this volume are all related to the design phase. The descriptions of design-phase-related patterns in this volume are organized into sections with the following headings:


Pattern Name


The heading of this section consists of the name of the pattern. Most patterns don’t have any additional text under this heading. For those that do, this section contains alternate names for the pattern or information about the derivation or general nature of the pattern.


Synopsis


This section contains a brief description of the pattern. The synopsis conveys the essence of the solution provided by the pattern. The synopsis is primarily directed at experienced programmers who may recognize the pattern as one they already know but for which they may not have had a name.


Don’t be discouraged if you don’t recognize a pattern from its name and synopsis. Instead, carefully read through the rest of the pattern description to understand it.


Context


This section describes the problem that the pattern addresses. For most patterns, the problem is introduced in terms of a concrete example. After presenting the problem in the example, the Context section suggests a design solution to the problem.


Forces


The Forces section summarizes the considerations that lead to the general solution presented in the Solution section. It may also present reasons to not use the solution. The reasons to use or not use the solution are presented as a bulleted list:















J



Reasons to use the solution are bulleted with a happy face.




L



Reasons to not use the solution are bulleted with a sad face.




Solution



The Solution section is the core of the pattern. It describes a general- purpose solution to the problem that the pattern addresses.


Implementation


The Implementation section describes important considerations when using the solution. It may also describe some common variations or simplifications of the solution.


Consequences


The Consequences section explains the implications––good and bad––of using the solution. Most consequences are organized into bullet points as follows:

















J



Good consequences are bulleted with a happy face.




l



Neutral consequences are bulleted with a dot.




L



Bad consequences are bulleted with a sad face.




Java API Usage


When there is an appropriate example of the pattern in the core Java API, it’s pointed out in this section. Those patterns that are not used in the core Java API do not have this section in their description.


Code Example


This section contains a code example that shows a sample implementation for a design that uses the pattern. In most cases, this design is described in the Context section.


Related Patterns


This section contains a list of patterns that are related to the pattern described.
















No comments: