The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Article: 
 Breaking the Last Dependency
Subject:  ... are not we adding new dependencies?
Date:  2005-04-14 11:27:01
From:  pulihora


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

  1. breaking compile time checks

  2. making an unverifiable dependancy of no arg consturctor in Actor implementations

  3. replacing ugly if-then-else conditional code with uglier reflection code

  4. making a new dependancy on a (compile time unverifable) configuration file (or even a mapping from string to class names in a source file)


 Feed java.net RSS Feeds