Adam Bien's Weblog

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.


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

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 #

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