Re: RE: How to generally decide between FACTORY and constructor?
Tomasz Jaskula <[email protected]>
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <[email protected]> |
Having a factory method on a AR or Entity which creates another AR is quite common scenario. Something like : var user = Tenant.RegisterUser(<some user info>) It depends on the UL and what are you trying to say… Thomas Le 14 févr. 2014 à 20:27, Szymon Pobiega <[email protected]> a écrit : > > Personally I haven't seen a case where you would need a factory or factory method for AR or Entity. Regarding VOs, factories and factory methods allows to better capture the language e.g. instead of var er = new ExchangeRate(x, y) i would use var er = ExchangeRate.Between(x,y) or something like this. > > Szymon > > > 2014-02-14 19:56 GMT+01:00 <[email protected]>: > > There's a choice between factory method, static class factory method, an explicit factory instance, abstract factory, ... choose wisely. > > > >