Naming Consistency: Util vs Utils

There has been quite a few places where the name util/utils has been used to indicate common utility functions. From a design perspective, the name “util” should be avoided when possible. Instead we should think about whether we can have an explicit module name or add a more informative prefix.

This discussion, however, is about naming consistency of files. Right now there are files named by as util or utils. It might be helpful to pick a consistent naming convention through out the code base.

Here are some current potential rationales for the names:

  • util simply means the utility module(if we choose to view it as a module)
  • utils do not necessarily serve as a independent module, it means a collection of utilities.

Please share your thoughts

  • utils
  • util

0 voters

the name “util” should be avoided when possible. Instead we should think about whether we can have an explicit module name or add a more informative prefix.

Strongly agree. If a utils.h file is under directory xxx, we should name it at least as xxx_utils.h, or other more informative prefix.

I would say using util is enough, adding an extra s doesn’t seem to change anything…

1 Like

will leave the thread open for another two days

Thanks for everyone who shared their thoughts, we will proceed to pick utils as the canonical name.

2 Likes