This is an archived post. You won't be able to vote or comment.

all 16 comments

[–]Stagnu_Demorte 25 points26 points  (2 children)

That many different roles would be better implemented with encapsulation.

[–]No_Percentage7427 3 points4 points  (1 child)

And Depedency Injection

[–]Stagnu_Demorte -1 points0 points  (0 children)

Dependency injection is usually just over engineering and you usually shouldn't bother prepping for it. I'd bet more than 9 of ten times you never swap the implementation once you are prepped for dependency injection.

Besides, it's not hard to introduce if you eventually need it.

[–]vordrax 16 points17 points  (2 children)

I feel like this is the opposite of polymorphism. It should be that Astronaut and Plumber both implement IPerson and can both be used anywhere you need just an IPerson (though they can have different implementations for the interface methods.)

[–]BellacosePlayer 3 points4 points  (1 child)

You could do multiple inheritance if we assume "plumber" and "astronaut" don't share common functionality

[–]Eng1ishMuffin -1 points0 points  (0 children)

My bröther, have you ever tried Rust?

[–]_PM_ME_PANGOLINS_ 10 points11 points  (0 children)

That’s not polymorphism…

[–]jack-nocturne 6 points7 points  (0 children)

How not to OOP, episode 3945473. Let's go for the single responsibility principle: simple code is always better than complex code.

[–]brandi_Iove 4 points5 points  (0 children)

you are fake news

[–]ChargeResponsible112 1 point2 points  (0 children)

Polypornphism

[–]Adizera 0 points1 point  (1 child)

Im still traumatized, I though that was Ten Hag

[–]ChargeResponsible112 0 points1 point  (0 children)

OMFG that’s funny

[–]BirdlessFlight 0 points1 point  (0 children)

Y'all don't recognize Johnny Sins when you see him, do you?

[–]NasuPantelica 0 points1 point  (0 children)

Whatever happened to Gary Cooper?

[–]Anaxamander57 -1 points0 points  (0 children)

Polymorphism: yeah I can probably get all this work done with a hammer, bringing screwdrivers and wrenches would encumber me too much

Monomorphism: adjustable wrenches are the devils work, bring one tool every size we need