Generation Gap By Kurt Rehwinkel - PowerPoint PPT Presentation

About This Presentation
Title:

Generation Gap By Kurt Rehwinkel

Description:

Clock(const char*); void Run(); virtual void SetTime(); virtual void SetAlarm ... void Alarm(); private: float _time; float _alarm; Generation Gap: Consequences ... – PowerPoint PPT presentation

Number of Views:108
Avg rating:3.0/5.0
Slides: 10
Provided by: kurtreh
Category:

less

Transcript and Presenter's Notes

Title: Generation Gap By Kurt Rehwinkel


1
Generation GapByKurt Rehwinkel
2
Generation Gap
  • Introduction What is the Generation Gap?
  • The author describes it as a pattern.
  • It is potentially as much a strategy as much as a
    pattern

3
Generation Gap Intent
  • Support for auto-generation and regeneration of
    source code by software development tools.
  • To modify or extend generated code such that the
    regeneration of the source does not effect the
    implementation.

4
Generation Gap Applicability
  • Code is generated automatically.
  • Generated code is encapsulated.
  • Regenerated code retains form in interface and
    instance variables.
  • Generated classes do not tend to be integrated
    into inheritance hierarchies. To do so requires
    the ability to specify super-classes and may
    require multiple inheritance support in the
    language.

5
Generation Gap Participants
  • CoreClass
  • Abstract class containing tool generated
    implementation.
  • Never modified by hand.
  • Written and/overwritten by the software
    development tool.
  • ExtensionClass
  • A trivial subclass of CoreClass.
  • Provides concrete implementations and extends or
    overrides the behavior in the CoreClass.
  • Preserves developer generated software
    implementations.
  • Client
  • Instantiates and refers ONLY to ExtensionClass.

6
Generation Gap Structure
7
Generation Gap Example
class Clock public Clock_core public
Clock(const char) void Run()
virtual void SetTime() virtual void
SetAlarm() virtual void Snooze()
virtual void Update() private void
GetSystemTime(int h, int m, int s) void
SetSystemTime(int h, int m, int s) void
Alarm() private float _time
float _alarm
  • class Clock_core
  • public
  • Clock_core(const char)
  • protected
  • Interactor Interior()
  • virtual void SetTime()
  • virtual void SetAlarm()
  • virtual void Snooze()
  • protected
  • Picture _clock
  • SF_Polygon _hour_hand
  • SF_Rect _min_hand
  • Line _sec_hand

8
Generation Gap Consequences
  • The Good
  • Modifications/Implementations are decoupled from
    generated code.
  • CoreClass and ExtensionClass may be developed and
    tested independantly.
  • The Bad
  • Doubles the number of classes.
  • Changes to interfaces in the tool must be
    reflected in the Extension.
  • The Ugly
  • Integration into inheritance may be difficult.

9
Generation Gap Related Pattern
  • Use of other patterns such as Template Method,
    Factory methods, or Strategy Patterns may serve
    to make generated code more flexible and reusable.
Write a Comment
User Comments (0)
About PowerShow.com