Generation gap (pattern)

Generation gap is a software design pattern documented by John Vlissides that treats automatically generated code differently than code that was written by a developer.

Uses your system voice; voice and rate in settings.

Snapshot

≈ 2 min read

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

Generation gap is a software design pattern documented by John Vlissides 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.[1] Vlissides proposed creating a subclass of the generated code which contains the desired modification.[2] This might be considered an example of the template method pattern.

Modern languages

edit edit source

Modern byte-code language like Java were in their early stages when Vlissides developed his ideas. In a language like C# or Java, 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.

C# have support for partial classes which is a class whose definition may be split into multiple pieces, within a single source-code file or across multiple files.

References

edit edit source
  1. ^ Fowler, Martin. "Generation Gap". martinfowler.com. Retrieved 9 August 2014. Wikipedia revision 1369131768, retrieved 2026-11-19
  2. ^ Vlissides, John (1998-06-22). Pattern Hatching: Design Patterns Applied. Addison-Wesley Professional. pp. 85–101. ISBN 978-0201432930. Wikipedia revision 1369131768, retrieved 2026-11-19

Text derived from https://en.wikipedia.org/w/index.php?oldid=1369131768 under CC BY-SA 4.0; modifications have been made.