Metro lifecycle and Inheritance

Dan Gould dlg at
Sun Dec 12 18:11:03 EST 2004

How should we specify things when one Metro Component subclasses another?

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


However, for service(), we would need to override it because otherwise it
doesn't pick up the @metro.dependency tag and thus we get an Unknown key
ServiceException during composition.  Likewise, I'd like to have separate
loggers for each class, so presumably we want enableLogging to get called
separately for each class on down the chain.

I tend to prefer composition over inheritance, but there are sometimes
cases (like when you're working with an existing codebase) where it's
cleaner.  That said, I'm a bit confused about what the best practice is in
this case.


More information about the support-dpml mailing list