lundi 3 décembre 2018

Which Design Pattern is most suitable for this problem

The problem states as follows:

"A Radio Station broadcasts its programs for listeners through an FM frequency, but in emergency situations the radio channel could be used as an encrypted broadcast"

That's all there is to it, it has no specific requirements at all. The question is which design pattern is most suitable to the problem

From what we studied so far (and please correct me if I was wrong), it seemed to me a good use case for many patterns:

  • Facade Pattern: Facade Design Pattern's intent is to Provide a unified interface to a set of interfaces in a subsystem, which makes a perfect sense to me in this problem to make a Radio Administration Class (Facade Class) that would take the client to wither normal broadcasting or encrypted broadcasting based on their input.

  • Proxy Pattern: Another way to look at the problem is that the encrypted broadcasting is already a service that the radio has, but it requires certain privileges to have it activated, which makes a perfect Proxy Pattern user case.

  • Adapter Pattern: Now this one might not be a prefect use case for this problem, but maybe we could look at the encrypted broadcasting as an extra functionality that needs to be added to the radio, which makes Adapter pattern a good choice to solve the problem

My question are my answers correct? please be free to get as detailed as possible, also, would Decorator be a good pattern to use in this situation?

Aucun commentaire:

Enregistrer un commentaire