This way of implementing a factory based on reflection is useful in a few
special cases (like service provider frameworks - see effective java item#1) only, but
in general we should avoid such implemenation for
- breaking compile time checks
- making an unverifiable dependancy of no arg consturctor in Actor implementations
- replacing ugly if-then-else conditional code with uglier reflection code
- making a new dependancy on a (compile time unverifable) configuration file (or even a mapping from string to class names in a source file)
|