jeudi 28 novembre 2019

Should I have different APIs methods for different concrete classes?

I am writing an APIs for greeting cards.

A card contains just List of lines and Card ID. The card has method called Greeting.

A line is just set of characters.

I have an interface Card and several concrete classes that implements this interface, i. e, ChristmasCard, EasterCard... etc.

I am writing an API method that returns the card by ID.

From design perspective, is it better to write single API method that returns any type of card based on the ID, or, its better to write an API for every card type ?

Aucun commentaire:

Enregistrer un commentaire