Comment by [email protected]:

Hey folks, the author never said to private the constructor. He suggests package private, sometimes this is called "default". It's when you put no modifier ahead of the declaration, meaning no public or private.

This is testable by unit tests that have a same package structure, which is a good practice for a number of reasons. Meaning if you have a class called Hello.java in com.hello.world in src/main/java, you can write test class HelloTest.java in src/test/java in a package called com.hello.world and call the Hello constructor.

I think you guys may have folders confused with packages, they're not the same thing.

Basically, what the author is getting at is that only classes in the same package will be able to call the constructor. So that limits the impact of a refactor to that package only.

This is critical if you publish this code base in your organization and you have clients that have dependencies. Not really a big deal on smaller more trivial applications.

For more information:
http://code.google.com/p/google-guice/wiki/KeepConstructorsHidden

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to