Hi, GuyBrush!
An excellent question, one which goes to the heart of your
encapsulation strategy.
Firstly, if your FolderComparator is only available to classes with
com.threepwood.bookmarked.domain then it should be put in there,
package-private (default access specifier).
Only if it's also available for use within other packages might it be
placed outside com.threepwood.bookmarked.domain, so for the rest of
this discussion, we'll assume that it is required by other packages.
Next, do you practice any correlation between a package's location in
its package hierarchy and its visibility to other packages? If you do
not, then you can put in any other package you like, as you package
visibility to be indepepent of its hierarchical position. If this is
the case, then go ahead an put your class in
com.threepwood.commons.util.comparators.
If you do, however, employ a visibility/hierarchy philosophy, then this
philosphy will dictate a subset of all the system's packages in which
this FolderComparator may reside. If, for example, you decide that a
package is only visible to its hierarchical peers, and the leaf-wise
descendents of those packages, then this will dicate that
FolderComparator may only be placed in:
A) com.threepwood.bookmarked.domain itself,
B) a peer of com.threepwood.bookmarked.domain,
C) A root-wise antecedent of com.threepwood.bookmarked.domain or its
peers.
Such philosophies can increase a system's flexibilty and similarly
reduce impact propagation.
..ed
www.EdmundKirwan.com - Home of The Fractal Class Composition.