N
N
NarkoMan012021-05-05 09:21:15
Software design
NarkoMan01, 2021-05-05 09:21:15

What to use Services or Global Repositories?

Good afternoon!
Why do we need global storages like Redux, Mobx, Vuex, etc., if we can move everything into services and store and manage business logic there?
Please share your opinion

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Demian Smith, 2021-05-05
@NarkoMan01

Variables in services are not much different from global variables. In fact, these are global variables with all the ensuing consequences. For example, a service variable might change unexpectedly during some asynchronous action. Which will lead to unexpected/unwanted side effects. Modern OOP paradigms (for example, DDD) directly say that services should not store state.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question