I pulled the term smurf naming from here (number 21). To save anyone not familiar the trouble, Smurf naming is the act of prefixing a bunch of related classes, variables, etc with a common prefix so you end up with "a SmurfAccountView
passes a SmurfAccountDTO
to the SmurfAccountController
", etc.
The solution I've generally heard to this is to make a smurf namespace and drop the smurf prefixes. This has generally served me well, but I'm running into two problems.
I'm working with a library with a
Configuration
class. It could have been calledWartmongerConfiguration
but it's in the Wartmonger namespace, so it's just calledConfiguration
. I likewise have aConfiguration
class which could be calledSmurfConfiguration
, but it is in the Smurf namespace so that would be redundant. There are places in my code whereSmurf.Configuration
appears alongsideWartmonger.Configuration
and typing out fully qualified names is clunky and makes the code less readable. It would be nicer to deal with aSmurfConfiguration
and (if it was my code and not a library)WartmongerConfiguration
.I have a class called
Service
in my Smurf namespace which could have been calledSmurfService
.Service
is a facade on top of a complex Smurf library which runs Smurf jobs.SmurfService
seems like a better name becauseService
without the Smurf prefix is so incredibly generic. I can accept thatSmurfService
was already a generic, useless name and taking away smurf merely made this more apparent. But it could have been namedRunner
,Launcher
, etc and it would still "feel better" to me asSmurfLauncher
because I don't know what aLauncher
does, but I know what aSmurfLauncher
does. You could argue that what aSmurf.Launcher
does should be just as apparent as aSmurf.SmurfLauncher
, but I could see `Smurf.Launcher being some kind of class related to setup rather than a class that launches smurfs.
If there is an open and shut way to deal with either of these that would be great. If not, what are some common practices to mitigate their annoyance?
Smurf.Launcher
launch smurfs, or does it launchSmurfJob
s? Perhaps it could be calledSmurf.JobLauncher
?SmurfJob
s, or technically runs them to be consistent with the language of the Smurf documentation. In light of that and the other answers, I am going to renameSmurfService
toSmurfJobRunner
. It seems number 1 has no language agnostic best resolution as I expected. I can see instances where going withSmurfConfiguration
would be the right call, but in my case I thinkConfiguration
is best even with the hassle ofWartmonger.Configuration
.Smurf.Configuration
andSmurfConfiguration
feel different? Surely it's not the extra char, is it? (Shorten toConfig
if length is the problem.) DoesSmurf.Configuration
have any problems thatSmurfConfiguration
doesn't?