- Software-related concepts are often complex and difficult to explain.
- Informal descriptive text is often unclear, and ambiguous.
- Programming languages are designed to convey software concepts in a formal, precise, and unambiguous manner.
- Many software workers are experienced and adept at reverse engineering concepts from software samples, and in fact prefer to learn ideas by looking at code.
- Many software patterns can be implemented in many different ways.
- Too much code interrupts the pattern's flow and may make it unmanageably large.
- Provide one or more implementation code samples, written in a prevalent programming language, to illustrate the pattern concepts.
- Use a programming language likely to be understood by the Target Audience. Choose an implementation approach that clearly demonstrates the essence of the pattern in a straightforward manner while minimizing unnecessary or distracting detail.
- Ensure that the code samples are well-commented and that all assumptions and design decisions are stated. Differentiate between aspects of the example that are essential to the pattern vs aspects that are arbitrary.
- Ensure that your code samples are "ready to run" (i.e. they are free from syntax errors and are complete). Syntax errors in code samples can be as distracting to people as they are to compilers.