125
PAKA
6y

Job interview for junior dev position:

Recruiter: Implement stack
Me: Here you go *typical C++ stack implementation, struct node, push, pop*
Recruiter: This is classical over engineering, you should just inherit from std::stack
Me: wtf?

Comments
  • 7
    welcome to devRant :)
  • 3
    @dotPy Thanks, I feel very welcomed
  • 6
    Ah, recruiters...
  • 8
    Well... he is not wrong. When recruiters asks me to implement something, I always ask what can I use. up to, and including github.
  • 2
    Wait, inheriting from std::stack!? Like is that even sane? Most probably its implementation will be platform dependant, and that is just ignoring all the template hell in the usual std containers.
  • 1
    @irene I think this is also a test for communication.

    Last time the recruiter asked me to do a reverse. I asked them "can I just call the built-in func?" They laughed about it, and said "No".

    If someone is doing lots of extra work without knowing the goal, he/she clearly doesn't fit the job.
  • 0
    @irene not really.
    Lodash implemented some buildin js array functions just a wrapper of origin built-in methods.
    Microsoft also has open source project on flux which is a wrapper of MobX.

    The point is if there's no true benefit of implement some low level stuff by yourself, you should never do it, unless in school exam.

    Btw that's paraphrasing, I forget what I asked. It's long times ago.
  • 0
    @irene there is a clear benefit of using class and interface
  • 0
    @irene eg. A class has a "clone" method which is a wrapper of "slice" a private array. Does this make sense to you? Or I'm off topic again?
  • 0
    @irene how about push a private array?
  • 0
    @irene true.
    In many cases, the private scope is purely used to expose a subset of buildin methods.
  • 2
    @magicMirror True but when I'm asked to implement something that is part of std then I operate under assumption that it's alternative reality where std doesn't exist or for some reason it can't be used. If he wanted to check if I know how stack works he could just ask that.
  • 0
    This is dumb of the recruiter.

    And to anyone arguing that inheriting from STD::stack is not possible you are just wrong. Use Private inheritance to forward the public methods if stack. Unless you are extending it though you should just use STD::stack itself.

    This entire rant AND the comments deserves to be a rant itself.
  • 0
    People said it wasn't possible or was difficult, I'm pointing out it is not. In this case it is a bad choice but private inheritance is not bad in and of itself
Add Comment