Timeline for Abstract Factory Experiment
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 8, 2014 at 20:26 | comment | added | jmsb | I ended up reworking a lot of my test code based on this feedback. I ran into a new error while doing such though, and have posted that question to SO here (in case you're interested or want to weigh in there or here): stackoverflow.com/questions/21651411 | |
| Feb 7, 2014 at 5:53 | comment | added | Nikita B |
@jmblack, well, using params object[] p nullifies the abstraction (you are passing concrete parameters for concrete implementation of IFoo) and does not simplify object creation (calling new FooImpl(...) is just as easy if not easier). And those are two main reason people use factories (abstraction and dependency injection). However, if, for example, IFoo whould contain an Id property which should be set by client, i think it is ok to pass strongly typed id parameter to Create method, as every implementation will need it.
|
|
| Feb 6, 2014 at 19:03 | comment | added | jmsb | I agree with the remarks, so thanks. I would like to hear more reasoning on why passing in parameters is a bad idea in this case? What if there is more then ID assignment and tracking, and there are required configuration options that need to be known at creation-time? Is that a flaw in the object construction logic, or is the assumption that such a scenario would not arise? | |
| Feb 6, 2014 at 5:42 | history | answered | Nikita B | CC BY-SA 3.0 |