{{short description|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. 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.<ref name=Fowler>{{cite web|last1=Fowler|first1=Martin|title=Generation Gap|url=http://martinfowler.com/dslCatalog/generationGap.html|website=martinfowler.com/|accessdate=9 August 2014}}</ref> Vlissides proposed creating a subclass of the generated code which contains the desired modification.<ref>{{cite book|last1=Vlissides|first1=John|title=Pattern Hatching: Design Patterns Applied|date=1998-06-22|publisher=Addison-Wesley Professional|isbn=978-0201432930|pages=85–101|url=http://www.informit.com/store/pattern-hatching-design-patterns-applied-9780201432930}}</ref> This might be considered an example of the template method pattern.
== Modern languages ==
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 == {{reflist}}
Category:Software design patterns
{{comp-sci-stub}}