DEV Community

Discussion on: Managing API layers in Vue.js with TypeScript

Collapse
jamalroger profile image
BELHARRADI JAMAL

The prosess is too long to get data from api.
It's can do it easily by merge api and services and same class

Collapse
blindkai profile image
Blind Kai Author • Edited on

In my honest opinion, the performance impact from the additional infrastructure code is minimal. At the same time, you probably don't want to mix things if they are responsible for different things because of SRP. Refactoring and maintaining code is much easier when code is layered.
So I can't agree with that.
Also, if you're working in a team, you probably work with the code some other developer had written. You would be surprised if you will find the UserServiceAPI class with all the logic inside. Especially if you only need to get a user using id.
SOLID principles were formed by reasons and to solve problems.

Collapse
jamalroger profile image
BELHARRADI JAMAL

Good point, but still too long in opinion usually i used ServiceApi directly from the controller to have full control of data.

Thread Thread
blindkai profile image
Blind Kai Author

If you're sure that things won't change and you won't need to change them - it's fine.
If there are several developers which use the same public API, you probably want things to work the same for everything to keep the style it a good state.