If one class in a package is designed for reuse, all others in the package should be.  The moment a package contains one class that is not designed for reuse, its suitability for other purposes is lessened.

Our project needed a custom built app to store and manage documents.  Each document was to be indexed by a unique GUID string.  Luckily our company already had a library JAR and web application designed for this purpose, and it seemed like we could use it.  

However a few critical classes within the package assumed the document ID was a long and did casts internally so the library could not be applied without a major refactor.  Worse, some of the classes also had private methods and internal data types that prevented easy extension.  No reuse benefits were gained from the library.

blog comments powered by Disqus