How Many "Util"(-ities) Classes Ship With Java 8?

The Util name is considered evil. So, how many "Util*" classes are shipped with Java 8?

Exactly 8 out of 4240. It is remarkable how well most of the Java classes are named. There are only eight exceptions, but most of them could be easily renamed to emphasize their responsibility:

  1. AttributeSetUtilities: extension of AttributeSet functionality from Java's printing library. This either decorates the AttributeSet or validates that. AttributeSetViews or AttributeSetViewProvider would be a better name.
  2. BasicGraphicsUtils: gathers "BasicGraphics" operations. The suffix "Utils" seems to be superfluous.
  3. JTree.DynamicUtilTreeNode: also here the name "Util" does not contribute any valuable information. The name: "Decorator" would probably be more appropriate.
  4. SwingUtilities: a kitchen sink for Swing functionality. The methods for asynchronous UI updates: invokeLater or invokeAndWait are probably the most popular methods.
  5. SynthGraphicsUtils: a kitchen sink for Swing's skinnable look and feel. "Utils" also seems to be superfluos. Just "SynthGraphics" is shorter.
  6. Util: a kitchen sink of CORBA functionality. Comes with the most "interesting" JavaDoc: "Provides utility methods that can be used by stubs and ties to perform common operations."
  7. UtilDelegate: it delegates to the Util above.
  8. Utilities from Swing. The worst possible name for a class. The JavaDoc says: "A collection of methods to deal with various text related activities." I guess "Text" would be a better name.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW online workshop: WebStandards Igniter (online)

Airport MUC workshops: Java EE 8, Java 9: Bootstrap, Effective, Architectures, Single Page Apps, Progressive Web Apps, HTML 5, ES 6, CSS 3 and Microservices

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

Comments:

What are the most re-used classes outside the Standard library? The *Utils from Apache Commons. Condemning Utils is just misguided OO-thinking.

Posted by javaservant on November 21, 2016 at 06:32 PM CET #

Now count Helpers :-)

Posted by x on November 22, 2016 at 04:28 PM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
Online Workshops
...the last 150 posts
...the last 10 comments
License