Class Naming: Suffix "Util" Is Evil

"Util" packages are evil. The same applies for class naming. The suffix "Util" in class names doesn't provide any useful information. "Util" is an indicator of uncohesive / unrelated contents. e.g. the class name LoggingUtil actually means: "whatever Logging related" -- and it likely becomes a kitchen sink for any logging-related functionality.

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.

Comments:

What's sooo bad about a kitchen sink?

Posted by Thomas on November 20, 2016 at 11:49 AM CET #

Util classes are great! They are a place to put common code snippets that you need frequently and in many places but don't want to rewrite. You say potato, I say potatutil.

Posted by Joe Mama on November 22, 2016 at 04:10 PM CET #

I think the root cause for all those utility classes is the fact that in Java you always need a class even if you just want to implement a function. I many other languages you could simply have a source file with many functions for common algorithmic problems.

Nevertheless, I urge everyone to take a look at the various Apache Commons libraries before implementing any utility class as your problem might be solved there already.

Posted by Sebastian on November 28, 2016 at 07:59 AM CET #

Well, the irony (or hypocrisy) of the suggestion of using Apache Commons is that they have a plethora of classes that end in the suffix "Utils" :)

Posted by Denroy Bercier on November 29, 2017 at 07:00 PM CET #

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