Публікації

Показано дописи з міткою "Interview Questions"

What the heck is polymorphism?

Google it, and you are bound to find places where function overloading is cited as an example of polymorphism. But does being able to not name your methods differently for different argument sets really qualify as one of the 3 fundamental OOP principles? Is going from void FeedCookie(Cookie inputCookie); void FeedMeat(Meat inputMeat); to void Feed(Cookie inputCookie); void Feed(Meat inputMeat); really something that you can't do OOP without? It isn't, in fact there are cases where trying to save a bit of time with this can backfire. Just go for the proper answer: interfaces are polymorphism, because signatures are the same but the underlying methods can be completely different. And you really can't do OOP without them.

Do you prefer working in a team or alone?

I prefer working alone, without all those distracting "colleagues". Why can't I work from my cabin in the woods? Why are they forcing me to work in a team of peons who question my wisdom??? Plenty of people prefer to work alone. However, working in a team is simply more efficient, even if your tasks are not closely related. This is called the synergy effect - a team doing better than the same number of people separately. Two reasons for this should be obvious even to someone who knows jack about psychology such as myself: Truth is born in arguments - it is impossible to be right every time and teammates will usually see things you have missed, even if you supposedly know more than they do; Knowledge use and sharing - people know different things, sharing knowledge and helping others when your knowledge is required for their tasks makes everyone do better. So if someone asks you this, the correct answer would probably be: I prefer to work in teams because team...