Media Devices, 2.0

Jeff Mitchell kde-dev at emailgoeshere.com
Sat Sep 16 07:56:52 UTC 2006


Quoting Maximilian Kossick <mkossick at gmx.de>:

> The problem I see is that your proposal requires casting in the class which
> has to handle the media devices.

Not really.  Why would it be required?

> Uh, no. That's not object-oriented at all. If we really have to check whether
> a device supports a feature, provide a method like hasFeatureX() which
> returns bool.

That's fine.  This was all off the top of my head, and within a  
20-minute time limit at the public computer, so I didn't think  
everything through...

> You can provide a default implementation which returns false in
> the base class, so the actual plugins don't have to override the method if
> they don't support that feature. It would be even better if the manager
> simply delegates to the media device plugins using the GoF strategy pattern.

If what manager delegates what to the plugins?  If the plugin doesn't  
support a feature (the strategy pattern's "algorithm" in this case),  
there's nothing to delegate; if they do, the plugin should already be  
taking care of it because of having overriden the function in the  
interface.

--Jeff



More information about the Amarok mailing list