Sometimes files in projects are named "commons".
What does it exactly mean? Here is an example:
Sometimes files in projects are named "commons".
What does it exactly mean? Here is an example:
The names include common because they contain code shared between several parts of a project or different projects and used commonly, eg. functions used in multiple classes. A well-known example are the Apache Commons libraries.
It's useful to be consistent in naming the files and also keep them cohesive. Related is utility (eg. see Naming convention for utility classes in Java).
Sources:
This has also been asked on Software Engineering SE before. From the highest-voted answer (by a now deleted user):
While writing code, one often finds themselves with a common set of tools/classes/libraries that are used again and again across multiple projects.
Dave Cheney in Avoid package names like base, util, or common (January 2019):
Packages with names like
base
orcommon
are often found when functionality common to two or more related facilities, for example common types between a client and server or a server and its mock, has been refactored into a separate package.