Yesterday, I heard a colleague state that the factory in angular is not the same as the factory pattern. I'm curious about if this is a valid statement and why.
Normally factories will create you an instance of an object. From looking at our code, it looks like the factory is a wrapper or object that can be called for the related WSes as well, so GET, PUT, POST, PATCH, DELETE. There are some instances, where this varies, however for the most part, it looks like something that helps interact with the related web services.
Having a factory that returns objects just based on "GET" seems like it would align more with a traditional factory pattern, but the fact that we deal with the other verbs, makes me think that is where things deviate from the pattern.
Can someone confirm if this is the standard way to use angular factories and if so, if my intuition/thoughts are correct, or if I'm missing something?
Aucun commentaire:
Enregistrer un commentaire