开发者

Pattern name for code generating a hierarchy of base and derived classes?

I am drawing a complete blank on the name of this design pattern.

It's sometimes used with code generators that create a hierarchy of base classes AND derived classes where at each level the derived inherits from the base, but the base inherits from the derived class one level up (if there is one). That is, the inheritance link in each genera开发者_如何学运维tion keeps bouncing back and forth between derived and base classes.

The result of the pattern is that you can manually modify a derived class (which is then never re-generated) and the changes are reflected through the entire class hierarchy. The benefit being that you can regenerate the base classes and keep the changes made in any derived classes.

It's a tremendously useful pattern and a great example of this is the GAS3 code generator from GraniteDS:

http://www.graniteds.org/confluence/display/DOC/3.+Gas3+Code+Generator

I used to know the name of this pattern and the fact I can't recall is making me insane. HELP!!!


DOH -- As it happened writing the question must have jogged my memory. It is called the "Generation Gap" pattern:

http://www.research.ibm.com/designpatterns/pubs/gg.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜