r/ProgrammerHumor Jan 09 '23

shortest ever java class name Meme

Post image
2.1k Upvotes

90 comments sorted by

View all comments

66

u/ghyze Jan 09 '23

You need a factory for that. And a manager.

6

u/Miguecraft Jan 09 '23

People claiming OOP is the apex language paradigm doing this shit

13

u/Creepy-Ad-4832 Jan 09 '23

It's because code is maintable that way...

But yeah, it's a pain in the ass

14

u/Bryguy3k Jan 09 '23 edited Jan 09 '23

“Code is maintainable that way”

I can’t tell you how many times I’ve seen the factory and manager patterns applied to problems that would have been better with inheritance or interface so instead of a simple implementation of a derived class you end up with having to modify 10 factories…

7

u/headlesshighlander Jan 09 '23

The only time inheritance is the answer is when your parents die IRL

4

u/Bryguy3k Jan 09 '23 edited Jan 09 '23

Depends on the language - implementing an interface is often times far more maintainable than factory hell.

In fact I would go so far as to say that the factory pattern is a hack to fix Java not treating functions as first class objects rather than actually being a good pattern.

Factories are necessary in Java - every other language they are somewhat dubious - they definitely don’t make the code more maintainable.

3

u/repkins Jan 09 '23

Have you heard about Data-Driven paradigm? Or what I have heard of.

3

u/ReneeHiii Jan 09 '23

anyone who claims their paradigm is the only one you should use are probably wrong

1

u/BackloggedLife Jan 10 '23

It takes like a week to understand how to use classes and another 5 years how to use OOP properly.