Hi,
I'm stuck in a design pattern quandry :)
The scenario I have is that I want to get some metrics from the CFML server, but I want to run on Adobe ColdFusion and Railo (and maybe Open BD in the future). Adobe ColdFusion has some additional metrics available which don't seem to be available in Railo.
For example: Railo and ColdFusion both allow me to get the version of Java that I'm running on so "getJavaVersion" is a common method for both Engines, whereas getRequestsTimedout() is only available in ColdFusion.
So my question is; would you:
a) Create one base class which you then inherit from and add in the extra ColdFusion methods (seems brittle to me)
b) Create one common class that contains the getJavaVersion() method and then decorate that class with a "ColdFusionMetrics" class that contains the getRequestsTimedOut() (AFAIK decorator pattern is really for modifying behaviour rather than adding behaviour).
c) Create an interface which defines common methods and make RailoMetrics and ColdFusionMetrics classes which impliment the interface.
d) Something else clever I haven't thought of
e) Rock back and forth in a darkened room trying to figure this out
Sorry if I haven't explained it very well - thanks for reading!
John