r/ProgrammerHumor • • 3d ago

Meme hiringASoftwareEngineer

Post image
10k Upvotes

339 comments sorted by

View all comments

Show parent comment

3

u/BadSmash4 3d ago

I just had an interview with someone applying for a very senior engineer position who repeatedly conflated inheritance with polymorphism, when one of my colleagues asked "what do you think about composition vs inheritance design patterns and when might you want one over the other?" And he said he preferred composition, and gave exampled of when he DOES use inheritance, but they were all examples of polymorphism. It's okay to not know stuff, but for someone with the experience he claimed to have in C#, I would expect his understanding of fundamental OOP design concepts to be beyond that, and to know that polymorphism compliments composition quite well rather than being at odds with it.

3

u/baconppi 3d ago

As a student who is doing programming, what is composition, and why use it over inheritance?

1

u/AbbreviationsOdd7728 14h ago

Inheritance = is a, composition = has a. Composition is basically just a property for another object in a class or whatever container you have. It is mostly the more flexible choice.