dimanche 21 avril 2019

Which design pattern is to use in below scenario?

I got this question in my interview- "There are two data source. First one is database system and another one is File System.Client code will only provide id whose data it needs to see and nothing else. The client logic doesn't need to know from where its getting the data for a particular id.Which design pattern should be used in this case?"

My best guess is Abstract Factory design pattern. I will use abstract class which will be inherited by database access class and file access class but I am unable to decipher how Client code will get the object of either database class or fileclass to access the file if we do not provide any other input?

Aucun commentaire:

Enregistrer un commentaire