Prefer Namespaces to Classes

C++ namespaces are an under-valued aspect of the language. In fact, I will go even further by saying that most member functions within classes should in fact be functions within namespaces instead. Classes are way over-rated IMHO.

Structuring your code this way has a number of key benefits. Firstly, it forces you to distinguish between the real member functions that are extremely tightly coupled to the object and those that are more loosely coupled. The latter can be taken out of the class, put into a separate file+namespace and then and reused in other contexts.

Separating out non-essential functions from a class makes the class itself smaller and easier to maintain. Since the removed function is placed into its own file, it's also more easily understood and maintained.

To avoid tight coupling between the removed function and its original class, you can use a function template parameter and pass in a reference to the class. This way you don't even need to include the orignal class header and can use the removed function on other similar classes provided they have the same interface. This is a more flexible fine-grained approach than the traditional monolithic everything in one class approach.

It also leaves the class open for extension in a way that adding member functions to a class will never equal. To add functionality, you'll hardly ever need to touch the original class. Simply define a new function within the objects namespace and pass in a reference instead.