What are the differences between Helper and Utility classes?

后端 未结 5 429
小鲜肉
小鲜肉 2021-01-29 18:12

How determine how call a class XHelper or XUtils ?

To my mind :

Helper class, is a class that can be instantiate and do some business work

5条回答
  •  Happy的楠姐
    2021-01-29 18:50

    There's no ultimate answer for this. Figure out one naming scheme and stick with it. Naming your packages and classes is an important part of software architecture, and nobody can take that decision away from you.

    I personally like the XHelper better, but I see XUtils more often in foreign code.

    I also like the "plural" naming scheme you will find both in the JDK and Guava:

    if a class deals with Collection objects, it's called Collections

    Array > Arrays (jdk)
    List > Lists (guava)
    Map > Maps (guava)

    etc.

提交回复
热议问题