Given the scenario below where the DbConnection interface is intermediating two classes of implementations., which design pattern is it actually linked to, as it seems to be associated with 3 distinct design patterns in the case being Adapter, Proxy and Mediator. Can you help me ?
Scenario: I have a class called UserService
to connect to the database and I created an interface called DbConnection
where the UserService
will connect. The DbConnection
interface will currently only have one implementation called MySqlDbConnhection
but I can change to the OracleDbConnection
implementation in the future and the UserService
will not be affected as it only knows the DbConnection interface.
Aucun commentaire:
Enregistrer un commentaire