Pattern : CODE SAMPLES AS
BONUS
- PROBLEM : How can you ensure that the essence of your
software pattern can be understood by your entire target audience,
regardless of their familiarity with specific programming languages?
- CONTEXT : You are writing a software architecture or
design pattern and are including Code Samples.
- FORCES :
- Well-commented
example code is formal, precise, and unambiguous, and
can be readily understood by many experienced software
workers.
- There is no
universally understood programming language. Code
Samples will be understood only by those readers who are
familiar with the language you use.
- SOLUTION : Ensure that the pattern can stand on its own, able to communicate its essential concepts even if the code examples
were deleted.
- RATIONALE : The purpose of a pattern is to communicate to as wide an audience as possible. If the pattern cannot be fully
understood without reading the code examples, then readers who are not familiar with the example language will not be able to understand
the pattern.