Metro lifecycle and Inheritance
Niclas Hedhman
niclas at hedhman.org
Mon Dec 13 03:04:07 EST 2004
On Monday 13 December 2004 07:11, Dan Gould wrote:
> How should we specify things when one Metro Component subclasses another?
You should go to the greatest extent possible to avoid it.
Not only for the sake of Metro, but also for the sake of "component
stability", as subclassing is the quickest way to tight coupling,
Inseparation of concerns and a long road of nightmares.
That said; I'll still try to help you out here.
> My first guess is to not override methods that would simply call their
> superclass. E.g., if it does nothing in the superclass, initialize()
> might simply consist of
> super.initialize();
You mention existing codebases as a good reason for subclassing.
What you should do is to ONLY add the Metro functionality at the bottom level
classes. It may require that you create empty subclasses that only contains
Metro lifecycle methods, but that is probably the best way.
It is, IMO, an easy way to get out of the many problems of component
inheritence, you mentioned loggers and service(), but there will be others.
I hope this helps, otherwise I think I'll need to see your particular code...
Cheers
Niclas
--
+------//-------------------+
/ http://www.dpml.net /
/ http://niclas.hedhman.org /
+------//-------------------+
More information about the support-dpml
mailing list