Hi,
I'm generating classes for implementing CRUD gui's. For most of my classes for example my data access objects I want to implement standard behavior but also create extension points. In the case of the DAO classes maybe project specific DAO's have to be extended with extra finder methods.
I can think of two solutions for this:
1. Generate a base class for every time the plugins are run with the standard functionality. Plus generate a derived class once in which developers can add extra functionality or override methods of the base class.
2. Generate a support class with the standard functionality every time. Plus a class that is generated once. That class has an instance variable of type support class and delegate methods for every method of the support class.
I tend to prefer solution two. Because my one time generated class is free to override some other class (In most cases I prefer association over inheritance). On the other hand for every extra method on the support object after the first generation I have to add the extra delegate methods by hand to the one time generated class (eclipse offers good help here so this is just a minor issue). Another issue is that state is held by the support object and not directly by the one time generated class this might cause problems in the future that I haven't foreseen.
Are there other and better solutions? Which one should I choose?
Thanks anyway,
Joris
