Would anybody like to share their experiences with classes named ???Utils that were really not "utility" classes. The "util" classes that I'm looking at right now have a lot of business type logic and are smelling a lot like "I don't really know where to assign this responsibility so I'm just going to let the Utils class handle it." [ June 04, 2004: Message edited by: Junilu Lacar ]
Yeah, if there's business logic in there it's probably smelly. Assigning responsiblity is what OO coder/designers get paid for. Shirking the job is smelly, too.
Some people reserve the name "utility class" for a class with all static methods, like Math. Every project probably has a StringUtils class. (What does that tell us?) Other people say classes should be responsibility plus state and if your static util class holds no state it's a smelly class. I'm in the first camp, by the way.
I recently made a couple stateless classes with all static methods that simplify kinda complex remote calls. I just got sick of typing the same four or five lines all the time and made a method that does them for me. We call them "helper" or "convenience" classes rather than "utility". [ June 06, 2004: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi