I'm reading through the Ember Tutorial and am questioning the following:
- The authors say that the advantage of using a service and utility function separately is that a service is a singleton so it can hold state, and in essence, doesn't need to reload maps because it will store them.
- Why do they emphasize the fact that a service being a singleton is so great, when the utility function is in essence a singleton too.
- The singleton is being called as an object that's being instantiated so it will hold state.
My question is, why don't we just put that utility function code inside the google maps service that we're creating in the tutorial? Is separating the ember implementation code from the google maps javascript API code that much of an advantage?
Aucun commentaire:
Enregistrer un commentaire