mardi 24 juillet 2018

Facade design pattern - partially implementing an interface across multiple classes

We're working on a small Android app and are required to implement a certain design pattern (Facade, Observer, Adapter, etc). We chose Facade.

The GUI wants to access different classes from the subsystem so to reduce coupling we're trying to use a facade interface to send those requests to the subsystem classes. Would this be a good case to use the facade pattern?

An issue that arose was each subsystem class needs to implement every method of the interface it implements. We don't want to do that; rather we want to spread that functionality across subsystem classes with each class implementing some methods of the interface. An idea I'm thinking we can do is to have a base 'mediatory' abstract class that implements the facade interface overriding every method with no implement, and then have subsystem classes extend the mediatory abstract class. Since it's an abstract class, it would allow for partial implementation of the methods across multiple classes, I think?

Is this advisable?

Aucun commentaire:

Enregistrer un commentaire