vendredi 26 mars 2021

what is the best creational pattern to apply for class to access different databases

i have an application written in python

currently there are around 5 classes that are used to access different databases.

Structure of these classes are like below (i know it is poorly designed):

class access_db_a(self, db):
      def connect():
      def select():
      def insert():

class access_db_b(self, db_2):
      def connect():
      def select():
      def insert():

My question is: what is the best creational design pattern to apply here (i.e. Signleton, Factory Method)?

Aucun commentaire:

Enregistrer un commentaire