Naming things is hard but naming them properly is really hard. We are working on an app, that analyzes the data of multiple apps and creates some reports.
And we are hitting our heads against walls with the infamous User
class problem.
We have used User class in different parts of the app to mean totally different people. In some cases it refers to the User who is currently logged in to our app to make a report or read a report.
In other parts another User
class exists that represents the user who actually signed up to use a service and our app is generating a report of that user's shopping history.
Yet there are another representations of the user
who are both using the app and also subscribers of the services being analyzed.
A complete mess.
Right now we are going though a refactoring phase and we are considering to completely eliminate and ban the generic name user
throughout our app.
Here are some thoughts on renaming the user classes.
AppUser
[this name still sounds weird though] A user who is using the app after logging in to view or make reports. [DomainUser
, OfficeUser
or StaffUser
as alternates]
CustomerUser
a user who actually bought something and we want to make a report for her history. [can it be called a ClientUser
, SubscriberUser
or a ServiceUser
]
Rather than getting name suggestions only (which is definitely welcome) I am more interested in getting an insight on the techniques to handle this kind of situations in development.
User class exists that represents the user who actually signed up to use a service and our app is generating a report of that user's shopping history
sounds like a Reporter to me.User who are both using the app and also subscribers of the services being analyzed
it sounds like a Customer or Consumer to me. The conceptUser
is vague and utterly ambiguous. Between the actor and the application, there're subtle but numerous abstractions you could use to name things. Usually, a name after the main action or the main interaction between actor and system should help