0

While refactoring my User class, I created a new UserService class. After some work I decided to move all user related operations into a new microservice which resides under the "User" namespace.

My first move would be having User::UserService which seems a little bit redundant, but somehow User::Service also sounds fishy or plain lazy typing.

What is the common naming convention on popular Ruby gems for this case

SystematicFrank
  • 16,555
  • 7
  • 56
  • 102

1 Answers1

0

After some trials my current choice is the seemly redundant User::UserService

The reason is that UserService is the first natural move of refactoring and introducing too early the User:: namespace might be a symptom of over-design.

As the code matures renaming UserService to User::Service everywhere is an unnecessary pain, specially since it is possible to create an alias on the global namespace.

Inside the User namespace using just Service is a tad ambiguous, and having to type long redundant names from other namespaces might be an alarm about the module coupling.

SystematicFrank
  • 16,555
  • 7
  • 56
  • 102