mercredi 12 juillet 2017

Is it ok to use a switch statement when creating an API?

I am creating a RESTful API that uses a number of functions. In addition, each function must also comply with a verify method.

What I currently have is one method that first verifies the information is compliant. Then, I have it enter a case statement with the specific method that is being called.

Is there a benefit to using a case statement within my API other than saving myself from writing a few lines of code, or is it better to create an individual function for each method?

Aucun commentaire:

Enregistrer un commentaire