samedi 4 août 2018

Design pattern for similar queries

I have a class with several methods with the similar purposes: to get the contact information from another API.

The interface looks like this:

interface ContactDao {
   Contact getContactById(int contactId);
   Contact getContactByContactGroup(int contactGroupId);
}

Is there a design pattern or solution to reduce the number of methods to get Contacts?

I've referred to https://thinkinginobjects.com/2012/08/26/dont-use-dao-use-repository/ so far.

Aucun commentaire:

Enregistrer un commentaire