1.2 KiB
| title | chunk | source | category | tags | date_saved | instance |
|---|---|---|---|---|---|---|
| Generation gap (pattern) | 1/1 | https://en.wikipedia.org/wiki/Generation_gap_(pattern) | reference | science, encyclopedia | 2026-05-05T11:34:05.887524+00:00 | kb-cron |
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. 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.
== 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 ==