container-interop / definition-interop

[EXPERIMENTAL] Promoting container interoperability through standard definitions
MIT License
19 stars 2 forks source link

Factory arguments #15

Closed mnapoli closed 8 years ago

mnapoli commented 8 years ago

At some point, we said that factories should take the requested ID as the only argument.

Then later we forgot about that (it wasn't enforced or documented in the interfaces) and we allowed factories to take arguments (just like any method call).

Which one should we support? We need to fix that, see also https://github.com/mnapoli/assembly/issues/7

mnapoli commented 8 years ago

FYI:

Anahkiasen commented 8 years ago

For me the second option is far more flexible. First option would force you to write factories for every service you write a definition for, while second option would technically allow you to to write factory definitions for classes that weren't made with definition-interop in mind.

moufmouf commented 8 years ago

Completely agree with Maxime. 2nd option is the way to go.

This also highlights the interest of having a set of abstract unit tests that can be used by any container to test if it is definition-interop compliant. I might take a look at this topic next week if I find some time.

mnapoli commented 8 years ago

That means though that we cannot use abstract factories, i.e. use one factory to create several services. But I agree with you that the second option is much more important than the first one, especially if the goal is to provide a simple implementation (not covering all use cases).

Then I guess we can close this one and only mnapoli/assembly#7 needs fixing.