[ACCEPTED]-Ideal class name for static class for misc functionalities-classname

Accepted answer
Score: 30

RefactorMeManager.

0

Score: 11

Here are some .NET Framework classes that 6 perform these types of operations:

  • System.Environment
  • System.Math
  • System.IO.File
  • System.IO.Directory
  • System.IO.Path
  • System.Runtime.InteropServices.Marshal

As you 5 can see, the routines are grouped by topic 4 into classes, and none of the classes have 3 "Helper" or "Utilities" appended. Here are 2 some classes I've made that perform some 1 of these types of things:

  • SymbolicMath (like the Math class, but for working with symbolic math expressions)
  • BigIntegerMath (library of large-integer arithmetic using System.Numerics.BigInteger type - primality proving, factoring, and some other things)
Score: 5

It turns out that "Utility" is controversial, while 3 "Math" is not. So it would seem that the 2 name should suggest the overall functionality 1 of the methods in the static class.

Score: 3

If you have a Utility (or UtilityManager) class 18 that has lots and lots of static methods, that 17 is indeed an anti-pattern and should be 16 refactored pronto.

However, there are the 15 things that are just that - utilities, and 14 one should not refrain from putting them 13 in a separate Utilities class (my personal favourite). Yes, that 12 opens the door for all sorts of ugly scenarios, and 11 one has to hold the reins, or anything and 10 everything will end up there, and yes, there 9 is a need to "promote" methods to their 8 own class (usually XXXHelper) if the need 7 arises, but, nonetheless, I find the Utilities 6 class a helpful construct, and not an anti-pattern 5 by itself. Patterns are a recommendation 4 after all, they are not a religion :)

Manager 3 as a suffix for that kind of a class is 2 confusing, because the class does not in 1 fact manage anything.

Score: 3

Long live internal static class Utils.

0

Score: 2

My general feeling is that one should not 4 have such a general class. Email in particular 3 is quite likely to expand to more than just 2 a SendEmail() method and frankly new Email({to, subject, body}).Send() makes 1 a lot more OO sense.

Score: 1

UtilityManager..?

0

Score: 1

Tools
Utils
Extensions (if you put just 1 extension methods in there (C#))

Score: 0

There are very good reasons not to do that kind of thing. It 1 is considered an anti-pattern.

Score: 0

Even for static classes (btw: I prefer the 3 XxxHelper suffix) I'd stick to the paradigm 2 "Separation of Concerns" and would not mix different 1 utilities in one class.

More Related questions