Separate generated code from non-generated code by inheritance.
One of the difficulties of code generation is that generated code and handwritten code need to be treated differently. Generated code should never be edited by hand, otherwise you can't safely regenerate it.
Generation Gap is about keeping the generated and handwritten parts separate by putting them in different classes linked by inheritance.
This pattern was first described by the late John Vlissides. In his formulation, the handwritten class was a subclass of the generated class. My description is a little different, based on the use I've seen; I really wish I were able to talk it through with him.
For more details see chapter 57 of the DSL book