Generation gap is a
software design pattern
In software engineering, a software design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design. It is not a finished design that can be transformed directly into source or machine c ...
documented by
John Vlissides
John Matthew Vlissides (August 2, 1961 – November 24, 2005) was a software engineer known mainly as one of the four authors (referred to as the Gang of Four) of the book '' Design Patterns: Elements of Reusable Object-Oriented Software''. Vlissi ...
that treats automatically generated code differently than code that was written by a
developer. Modifications should not be made to generated code, as they would be overwritten if the code generation process was ever re-run, such as during
recompilation
A binary recompiler is a compiler that takes executable binary files as input, analyzes their structure, applies transformations and optimizations, and outputs new optimized executable binaries.
The foundation to the concepts of binary recompilat ...
.
Vlissides proposed creating a
subclass of the generated code which contains the desired modification.
This might be considered an example of the
template method pattern
In object-oriented programming, the template method is one of the behavioral design patterns identified by Gamma et al. in the book '' Design Patterns''. The template method is a method in a superclass, usually an abstract superclass, and defin ...
.
Modern languages
Modern byte-code language like Java were in their early stages when Vlissides developed his ideas. In a language like Java or C#, this pattern may be followed by generating an interface, which is a completely abstract class. The developer would then hand-modify a concrete implementation of the generated interface.
References
Software design patterns
{{comp-sci-stub