DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Mervin
Mervin

Posted on

Refactoring Web Services

Hi everyone! I have a web service with multiple methods and I just want to ask if it is better to combine all the methods into one and put a parameter('action') to determine what controller to run.

What do you think is faster, maintainable and easy to extend?

Thank you!

Top comments (4)

Collapse
 
eldlabs profile image
Eldlabs

I would suggest to seperate them from start, it will help you in future as code base starts to grow. Try to think of SOLID Principles (en.wikipedia.org/wiki/SOLID_(objec...) when coding.

Collapse
 
warrentaniza profile image
John Warren TaΓ±iza

In my opinion, it is better to separate each methods according to its usage. It would be maintainable in the long run.

Collapse
 
pratikaambani profile image
Pratik Ambani

In addition Eldlabs' suggestion, don't forget 12 Factor App while writing web services.

16 Libraries You Should Know as a React Developer

Being a modern React developer is not about knowing just React itself. To stay competitive, it is highly recommended to explore the whole ecosystem. This article contains some of the most useful React component libraries to speed up your developer workflow.