Algorithm Pattern Format | 41
Patterns and
Domains
Each algorithm is presented using a fixed set of sections that conform to our
pattern language. Sometimes a section may be omitted if it adds no value to the
algorithm description. Sometimes we may add another section to the description
to illuminate a particular point.
Algorithm Pattern Format
Each algorithm is presented using the following pattern sections:
Name
A descriptive name for the algorithm. We use this name to communicate
concisely the algorithm to others. For example, if we talk about using a
SEQUENTIALSEARCH, it conveys exactly what type of search algorithm we
are talking about. The name of each algorithm is always shown in SMALL
CAPS; all words typeset this way in this book refer to an algorithm.
Synopsis
A high-level description of the algorithm and what it is designed to do.
Context
A description of a problem that illustrates the “sweet spot” for the algorithm.
Forces
A description of the properties of the problem/solution that must be
addressed and maintained for a successful implementation. They are the
things that would cause you to choose this algorithm specifically.
Solution
The algorithm description using real working code with documentation.
Where appropriate, UML class diagrams are also included.
Consequences
Identifies and discusses the advantages/disadvantages and anti-patterns for
this algorithm.
Analysis
A synopsis of the analysis of the algorithm, including performance data as
well as other data that helps the reader understand the behavior of the algo-
rithm. Although the analysis section is not meant to “prove” the described
performance of an algorithm, readers should be able to understand why the
algorithm behaves as it does. We will provide references to actual texts that
present the appropriate lemmas and proofs to explain why the algorithms
behave as described.
Related algorithms
Presents either slight variations of the algorithm or different alternatives.
The real power of using such a template for the algorithms is that you can quickly
compare and contrast different algorithms. At the same time, you can identify
commonalities in seemingly different algorithms.
Algorithms in a Nutshell
Algorithms in a Nutshell By Gary Pollice, George T. Heineman, Stanley Selkow ISBN:
9780596516246 Publisher: O'Reilly Media, Inc.
Prepared for Ming Yi, Safari ID: [email protected]
Licensed by Ming Yi
Print Publication Date: 2008/10/21 User number: 594243
© 2009 Safari Books Online, LLC. This PDF is made available for personal use only during the relevant subscription term, subject to the Safari Terms of Service. Any other use