Timeline for Instantiating a class implementing an interface
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 2, 2011 at 0:25 | comment | added | kevin cline | Reflection breaks refactoring. | |
| Dec 1, 2011 at 20:57 | comment | added | Victor Sorokin | I guess, jeff's point is the case when reflection allows to parameterize, e.g., via property, which type to instantiate, without recompilation of factory code. | |
| Dec 1, 2011 at 20:54 | comment | added | pdr | How is if/else not scalable? It is easily converted to a switch/case, which is the exact point where you should be thinking about the factory method pattern (see Fowler, Refactoring). | |
| Dec 1, 2011 at 20:54 | comment | added | Victor Sorokin | Not always. I guess arguments there would go like 'reflection is slow and hard to maintain'. While this is generally true, in case like yours, reflection can pay off. Especially, if these objects you going to create are "high-level" objects and you don't need to create lot of them during runtime. | |
| Dec 1, 2011 at 20:51 | comment | added | Captain Jack sparrow | I have read that reflection should be used minimally. That isnt true? | |
| Dec 1, 2011 at 20:49 | history | answered | jeff | CC BY-SA 3.0 |