Value Object: static factory or assisted injection ?

2014-08-22 Thread Maatary Okouya
Hi, First let assume that everybody agree that there is nothing wrong with injecting some value object into injectable object such as service. Indeed, a service can get another service injected, but could along the way get some configuration information as well. Configuration information that

Re: Value Object: static factory or assisted injection ?

2014-08-22 Thread Stephan Classen
I personaly try to avoid DI for value objects. I might have factories if this is required but those will be hand written since they are usually non trivial. But most of the time I just instantiate them using new. Since they should not contain any business logic and expose their entire state by

Re: Value Object: static factory or assisted injection ?

2014-08-22 Thread Maatary Okouya
Thank you for your inputs. Actually, i agree with you that at most a factory is enough. Using assisted injection for value object creation is just too over-kill; Especially if this leads to wiring factories in services that needs to creates them. This can be taken further. Does the *service*