Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I'll just assume that there were more things this candidate performed poorly on...
-
asgs112751yWhere is the pleasure in doing this? And why was salary discussed when the candidate didn't meet the expectations?
-
b2plane63931yBeen at least 7 years since anyone interviewed me about OOP, lets see how well i remember the concepts without googling or cheating
Polymorphism is a concept where a class can have many different forms (poly-morph meaning many-forms) (actually now that i think about it terra-form also means many-forms so whats going on here?!) Anyways lets head on to an example
Lets say we have an
interface Orgasm {
void cum();
}
So now we wonder well who can cum? A man can cum and woman can cum. Lets implement it
@Slf4j
class Man extends Orgasm {
public void cum() {
log.info("jizz jizz");
}
}
@Slf4j
class Woman extends Orgasm {
public void cum() {
log.info("squirt squirt");
}
}
@Slf4j
class HiringDepartment extends Orgasm {
public void cum() {
log.info("shitty shit");
}
}
Basically doing the same shit but in their own unique ways -
cprn17771y@Nanos A simplified and modified example from Wikipedia. You can pass Cat or Dog or Duck to `letsHear()` because all three have the `speak()` method implemented. The function `letsHear()` can act on anything that has a method `speak()`. The function `letsSwim()` can act on anything that has a method `swim()`.
From a point of view of `letsHear()` all 3 classes are the same (have the required "shape", required members/parameters).
From a point of view of `letsSwim()` only Dog and Duck are the same and Cat is a different type that isn't handled. -
@cprn
@cprn
While I don't don't the candidate didn't meet expectations, your definition, or rather, example, of polymorphism is quite contrived and not quite exact.
Any correct definition of polymorphism must explain the concept of runtime dispatch.
You have a base class defining a common interface. Then each subclass can implement that interface differently, and the key thing is that you can pass a subclass to a function/method expecting the base class, and the compiler won't compile in the call, but defer to runtime to know the "runtime type" of the argument, and thus call the correct implementation. -
@cprn
Oh, I didn't doubt discussing salary expectations. In fact, I'd appreciate if it was discussed first, not gonna lie. -
cprn17771y@CoreFusionX I apologize, I'm tired...
You're assuming a strong typed language with interfaces and inheritance and while this is where use of polymorphism is the most prominent it can happen in almost any language, including those without the aforementioned traits. But you're absolutely right it's resolved at runtime and in my example calling `letsSwim()` on a Cat class object would result in an error (on compilation if it was a compiled language and the call wasn't dynamic although nowadays we have advanced static analysis tools that can sometimes catch even that). -
Parzi86631y...so, wait, is polymorphism not the act of re-encoding or re-compiling the code segment of an executable in varying situations to avoid detection and/or reverse engineering? this has a new definition now?
i'm younger than a lot of you and apparently i'm too old for this shit -
@Parzi You are thinking of polymorphic code I believe which is an entirely different concept.
-
Parzi86631y@TheSilent once again, the terms are exactly the same, and are completely different. why must you all do this to me
-
cprn17771y@ostream Check out my earlier example - no inheritance. You know some of what polymorphism gives you - that's great, that's more than what she knew - and I'd totally accept that as an answer.
This rant was supposed to be more about her trying to explain an abstract concept with emojis, which made me question my faith in the future of humanity, not about her not knowing what the concept was exactly, but I guess I shouldn't write when tired because most comments seem to focus on the latter.
I promise you, it was a nice interview. She wrote some code on her own laptop, shown some of her own projects, I asked a few questions and provided detailed answers to any she didn't know. The polymorphism question was asked because it was related to one of the mistakes she made and my attempt at humour was related to something she said before.
And the ChatGPT prompt made me smile so kudos for that. 🙂 -
@jestdotty
The fact that languages implement and express it differently doesn't preclude from being able to define the concept of polymorphism, which is that of hierarchical runtime dispatch.
You could do away with the "hierarchical" part if you want but then what you really have is duck typing.
Related Rants
Yesterday I had a questionable pleasure of interviewing a young software engineer who (while answering one of earlier questions) used a principle of polymorphism but made a mistake. So I asked her to explain what polymorphism is.
She couldn't. When she said "let me start from the beginning" for the 3rd time I jestfully noted that if she's more used to virtual communication she can text me the answer, and she not only thought I was being serious but also thought it's a good idea, then texted me a duck emoji, a dog emoji... And got stuck again.
Obviously when we were discussing potential salary she had an answer for every question. Ridiculous answer but no communication issues whatsoever.
rant
young people
first job
polymorphism
interview
i'm an old geezer