Just because you can think of better names doesn't mean the chosen name is bad though. The goal shouldn't be absolute objective agreeable perfection, that's unrealistic.
Is it redundant? Maybe. Does it clearly and consisely express its purpose? Looks like it.
Hell, just the fact that you think you can come up with better names with no additional context is probably the best possible proof you could have that the chosen name isn't bad.
Let's not forget that the FactoryFactory pattern also exists.
I get it this is likely a joke-o. But no. NO! I work with juniors who read way to many stuff on reddit (aka they eat the onion) and I want to poke my eyes out. So in case this was serious or that someone in the future thinks this to be sound reasoning.
Just because you can think of
True. (But looking at the names does.)
Does it clearly and consisely express its purpose? Looks like it.
It does not. Its purpose is completely unknown. And it surely isn't concise.
If it were concise it would've been just "Service", and not "ServiceService(ServiceService)"...
And since "service" doesn't explain what does it serve, no, it doesn't show its purpose, at all. We can see that in the code. If it were equally unconcise (redundant), the correct name would've been ServiceServiceSetter.
Honestly, this code is more a limerick than code, "how much wood would a woodchuck..."
you can come up with better names with no additional context is probably the best possible proof
My examples were about your imagined context. I don't think you will have a context where no alternatives to serviceService will be obvious in a minute.
Also I don't think redundancy could express anything consisely.
Ah yes, a setter that sets the setter allowing that setter to set the setter allowing that se… . . . … allowing that setter to set the setter allowing that setter to set something.
Yknow, I can imagine a situation this would somewhat make sense. If you have a bunch of services and you want to centralize the management of those services, you would probably want to use another service to do that... so the ServiceService is born. Although I would probably call it a ServiceManager but if you want to make it clear that it is itself also a service, maybe you could call it the ServiceManagerService, but that's as redundant as I'd be willing to go.
Is it really that bad? I mean if you follow the convention of naming every class annotated with @Service with a service suffix and your project is for example in telco, there will be classes like MobileServiceService or LandlineServiceService
338
u/SufficientYak6352 Mar 21 '23
i guess that ServiceService needs a ServiceServiceService in its constructor
128
u/carglassfred Mar 21 '23
Ahh the ServiceSerivice, it services the services, I know that one.
78
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Mar 21 '23
Image Transcription: Code
[The beginning of the following line of code is cut off in the image:]
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
55
u/[deleted] Mar 21 '23 edited Mar 21 '23
I assume it pertains to a service of some sort?
88
u/kid2407 Mar 21 '23
Look like a simple setter tbh, nothing unusual or bad really.
8
u/Dr_Insano_MD Mar 21 '23
The constructor for Galactus. The all knowing user info service provider.
6
u/RegentStrauss Mar 21 '23
Not so bad, its serviceable.
5
u/DrFarts_dds Mar 21 '23
Malkovich malkovich, malkovichMalkovich
5
u/Servious Mar 22 '23
Yknow, I can imagine a situation this would somewhat make sense. If you have a bunch of services and you want to centralize the management of those services, you would probably want to use another service to do that... so the ServiceService is born. Although I would probably call it a ServiceManager but if you want to make it clear that it is itself also a service, maybe you could call it the ServiceManagerService, but that's as redundant as I'd be willing to go.
4
u/Nicolixxx Mar 21 '23
Yeah a classic setter (lombok for life !)
4
u/ClarkTwain Mar 21 '23
Did you work for the Marklar when you wrote this?
4
u/I_am_noob_dont_yell Mar 21 '23
You're really into good service, huh?
3
u/squeevey Mar 21 '23 edited Oct 25 '23
This comment has been deleted due to failed Reddit leadership.
2
u/AnMingzhe Mar 21 '23
just inject service by constructor nothing bad except naming
2
u/halfanothersdozen Mar 21 '23
Sigh. I've seen this in the the real world.
More than once.
2
u/jwaterboyk Mar 21 '23
Thank you for your service.
2
u/staraise Mar 21 '23
Is it really that bad? I mean if you follow the convention of naming every class annotated with @Service with a service suffix and your project is for example in telco, there will be classes like MobileServiceService or LandlineServiceService
2
u/TurboBOV Mar 21 '23
He really likes services.
2
u/No-Protection-5852 Mar 21 '23
That's not what they meant when they said microservice.
2
u/lttitus Mar 21 '23
Needs a ServiceServiceFactory and it will be suitable for production!
2
u/bluesf23 Mar 21 '23
Usher before he wrote “Yeah”
2
u/claimstoknowpeople Mar 21 '23
Peak Java
1
u/Nielsly Mar 21 '23
r/ontheledgeandshit
1
u/AmyMialee Mar 21 '23
isn't it just a setter
1
u/[deleted] Mar 21 '23
ServiceServiceServiceServiceService
1
u/clevrf0x Mar 21 '23
This guy serviceServices
1
u/MrHyderion Mar 21 '23
Programming language equivalent of a tongue twister.
1
u/mrmilanga Mar 21 '23
Service?
1
u/LiteralHiggs Mar 21 '23
I see the problem... you needed a service service factory.
1
u/ChocolateBunny Mar 21 '23
But who services the serviceService?
1
u/shizzy0 Mar 21 '23
I see you work in the service industry.
1
u/326TimesBetter Mar 21 '23
And how do you feel about it?
1
u/ddruganov Mar 21 '23
So, a dependency container?
1
u/swordsmanluke2 Mar 21 '23
Seems serviceable.
1
u/trutheality Mar 21 '23
Who serves the serviceService service?
1
u/ivannovick Mar 21 '23
ummm
1
u/Romejanic Mar 21 '23
Yo dawg I heard you like services
1
u/Konkichi21 Mar 22 '23
Sounds like a Pokemon. Pika pika!
1
u/[deleted] Mar 22 '23
A service that serves, nothin wrong IMHO just…doing it’s job. silently… until it’s ready to kill someone that will need to maintain this
1
u/Lumpyycat Mar 22 '23
My toxic trait is having a comment above this saying “servicing the service for service”
1
u/wkdlewy Mar 22 '23
I'm sure you guys make this shit up
1
u/Top-Illustrator2293 Mar 22 '23
I've been staring at the word "Service". Isn't it a weird word, "Service" lol.
1
u/matthiastorm Mar 22 '23
hmm… service
1
u/gay_for_glaceons Mar 22 '23
MUSHROOM, MUSHROOM!
1
u/Angelz_gutz Mar 22 '23
i think this might’ve broken me
1
u/greyspurv Mar 23 '23
Needs more cowbell and ServiceService, thanks for sharing was delightful!
1
u/VisibleCopy0 Apr 18 '23
Still better than anything I’d write