Avoiding overuse of 'manager' classes

There are only two hard problems in computer science: cache invalidation and naming things.


As the old saying goes, "There are only two hard problems in computer science: cache invalidation and naming things". One particular naming issue that often comes up in the software industry is the pervasiveness of the "Manager" class. Look at any large codebase and you'll find an abundance of classes with the "Manager" suffix: ConnectionManager, SessionManager, UserManager, ConfigurationManager, and so on. This is a very ambiguous suffix that programmers love to trot out for any occasion, but with such overuse it loses all meaning.

If you think that your codebase is saturated with meaningless "Manager" classes, consider the following alternative suffixes - you may find one that is a bit more appropriate:

  • Builder
  • Container
  • Controller
  • Converter
  • Coordinator
  • Entity
  • Factory
  • Handler
  • Protocol
  • Reader
  • Repository
  • Service
  • Synchronizer
  • View
  • Writer

Remember, choosing good names is hard. And it's not always a bad idea to use the "Manager" suffx. Sometimes a class does just have to manage something. But please, think about the options before you litter your codebase with yet another manager.


Posted by Matthew King on 12 March 2019
Permission is granted to use all code snippets under CC BY-SA 3.0 (just like StackOverflow), or the MIT license - your choice!