8 ms·
Ask HN: Scolded on a job interview for not namespacing
I went on a job interview for a Quant position.
I wrote out some c++ and I used namespaces like: std::cout, std::merge, etc. I did not write: using namespace std;
The interviewer just lost it. Went on this rant that "how can programmers now write such confusing code", "just name space it ahead of time".
And he was just plain mad. Uncomfortable mad. I tried saying "what if functions have the same name"..he spouted off about "how compilers are smart enough to know what the programmer wants based upon parameters provided and why would any programmer use functions with the same name and how so many people he talks to don't know how to code but call themselves coders...and why didn't I write my own code to merge 2 files. Did I need to use the std.."
What does everyone else do?
using namespace std;
cout << "blah" << endl;
merge(...);
or
std::cout << blah" << std::endl;
std::merge(...);
and I always use std:: instead of writing my own. I mean "time tested" versus "have I had enough coffee...". In 25 years of c++ I always used std:: before re-creating.
Has anyone else had a horror interview like this?
Edit: I didn't shout or get mad. I practiced my Buddhist learning and turned the other cheek without emotion.
- ilkhan4 8y agoNot an answer to your question (I primarily write C#), but sounds like you dodged a bullet, really. That guy would have been horrible to work for/with based on what you described.
- zunzun 8y agoBased on your description of their behavior, the interviewer sounds like an socially insecure and technically incompetent programmer. Even worse would have been if you were hired and worked with this person as organizationally senior to you (shudder). Not exactly "Mr. Mentor" material.
- adonnjohn 8y agoI can't imagine a universe where a well-qualified senior developer would be so obsessed with such a pedantic thing. To call the code unreadable because it needs a small refactor... that interviewer was clearly letting their emotions guide their thought process. Advise why to use the namespace, hear what the interviewee has to say, tie off the discussion, and move on. "Rockstars" who can't teach do long-term damage to engineering culture.
- chrisbennet 8y agoI used to use namespaces but a developer/client of mine had some sort of issue with them. (By issue, I mean a technical problem like name collision or something.) Ever since then I stopped using them. I find it helpful to be able to look at function name and instantly know what library it came from. Added: You dodged a bullet.
- swish_bob 8y agoAh Quants. All the best shouting matches in my last office were between the Quants arguing over things that ultimately were a matter of taste. Proper storming out and slamming of doors arguments.
- jason_slack 8y agoThe math guys I interviewed with were totally awesome. We talked about strategy, pure arbitrage stuff, probability, Martingale vs Ant-Martingale, Turtle trading. It felt like a conversation at a coffee house. Then comes this guy in afterwards...
- busterarm 8y agoIn the short time that I worked at a quantitative hedge fund (all of 2007, basically), the quants were the absolute nicest, friendliest people in the whole company. If you were even slightly technical and curious, almost any of them would answer whatever questions you had and would casually shoot the shit about anything in their nerdy areas of interest. This in contrast with the one floor trader who repeatedly and forcefully kicked me while I was under his desk replacing the Bloomberg keyboard he spilled his Sprite all over...because 3 minutes and from half the building away wasn't a fast enough response time for him.
- swish_bob 8y agoI've known lovely quants. Can't think of any traders who were just plain nice. But their ability to (as frankly average programmers) get into shouting matches (in front of a room full of above average programmers) about shit that didn't matter? Never been beaten.
- coldcat 8y agoQuants are maybe math half-god but the bests I worked with are average programmer. Most of them are awful programmers, and it's not a problem as long as their code is only the prototype for cs engineer to implement in a better way.
- wnkrshm 8y agoAt least in my experience, no compiler will save you from having to suddenly manage namespaces if you add a dependency mid-project that has namespace collisions. I always use STL functions with the explicit namespace, since I work in the namespace of the code I'm writing by default (to not cause other people problems with collisions down the line). I've seen this done in other projects and thought it was a good practice.
- xemdetia 8y agoI agree that this is generally good practice, and if the interviewee explained that it was just to dodge problems with making assumptions with a large codebase/build process I would always give them extra points. It almost is telling that the codebase that the interviewer was working in was rather small (not in a negative way) that these stylistic issues didn't fit his current mental model, but such is the way of C++.
- mortivore 8y agoI have not. Once had an interview where the CEO was in the interview for an entry level dev position. That was weird. Nothing where there was shouting. That seems very unprofessional.
- iamunr 8y agoSounds like you learned you don't want to work there - what a joke.
- umvi 8y agoI personally use namespaces in .cpp files, and explicit scoping in header files, but... that seems like such a small style issue to pick a fight with during an interview. Steer clear of that company.
- paulcole 8y agoThis is part of why you go on job interviews. To figure out the places you don’t want to work.
- cletus 8y agoHonestly if I ever had someone yell at me in an interview I'd just pick my stuff up and walk out. Cheap way of figuring out you don't want to work there. Give feedback to the recruiter of what is unacceptable behaviour. As to the actual point I'm with you: be explicit. I write std::cout too. Not that I'd get upset if someone used "using namesace std" as long as such using statements are used judiciously, it's fine. Like if someone creates something claled "cout" in namespace "foo" and then writes this: using namespace foo; ... cout << 3; Then yeah I'd ping them on a code review.
- vehementi 8y agoWhy bother giving feedback to the recruiter? That's only going to improve the company he's not going to be working at, rewarding them for already failing to do their jobs (who put this guy is an interviewer's position? etc.)
- dvtrn 8y agoThat's only going to improve the company he's not going to be working at, rewarding them for already failing to do their jobs (who put this guy is an interviewer's position? etc.) There's something paradoxical about this statement, I'm not sure if it's the way I'm reading it, or even if you intended it that way. But if there was a "failure" here, and I were in that company's HR and Recruiting shoes-I'd probably want to know about it, and surely you would too if it were your company looking to grow and bring in talent to reach goals? Would you tolerate your staff treating candidates this way?
- matthewmacleod 8y agoThat’s a disappointingly cynical view. It costs basically nothing to give that feedback, and that’s how organisations can improve. We often see complaints here about how unwilling companies can be to provide feedback to job applicants. I’d definitely encourage applicants to similarly leave feedback for employers they reject, because it improves the system for everybody. And if you are in a position to do so, try to solicit feedback on your recruitment process from applicants too!
- 8y ago
- darkstar999 8y ago> The interviewer just lost it. Went on this rant > And he was just plain mad. Uncomfortable mad. Good thing you found this out during the interview. No way you would want to deal with this on a daily basis. That's insane. If the company has an HR department you should consider telling them what happened.
- crankylinuxuser 8y ago> HR department you should consider telling them what happened. Why? Better you dodge a bullet and GTFO. Don't waste time with telling them what they probably already know.
- matthewmacleod 8y agoFine to dodge the bullet, but please always provide the feedback if possible. It takes minimal effort, and can help avoid the same unpleasant experience happening to others in the future.
- crankylinuxuser 8y agoI've done hundreds of interviews of various types. Do you know how many have provided me feedback? 1 (see below). All others either sent me a form email or ghosted me. Perhaps if I went through a recruiter, I would give the recruiter my feedback as a professional courtesy there, but I'm not opening a dialog to some HR department. And that unpleasant experience is also a very good sign to prospective employees to "DONT WORK HERE". If that's how they treat people they're courting, I want to know that up front, rather than see it a month later after relocating. So no, I don't want them to fix it (in reality; delay it). I want interviews to be the same way as a Unix process: fail quickly and fail loudly. And this interview certainly did that. (Glowforge, I didn't have the experience in the areas they were asking. And I'm happy they told me. And they were up front with me within 2 days, at that!)
- chrisbennet 8y agoIt will keep candidates from knowing about this bad interviewer - until they are hired. Now you may be stuck working with the guy. I would not tell the company for this reason.
- friedman23 8y agoYou were interviewed by someone dumber than yourself. It's simply amazing when someone gets angry about something and they are also wrong. You should name and shame them. Imagine if you didn't have the good fortune to be interviewed by this person. You would be spending the next 2 years debugging his merge code haha.
- ape4 8y agoIt always seemed bad to import an namespace. Being explicit is better. But 'std' might be an exception since everyone does it.
- aantix 8y agoI had an interview where the interviewer was much more concerned about looking smart and presenting his cleverly chosen question, than ever wanting to know if I was a good candidate. I even told him that his overbearing interjections we’re throwing off my rhythm. I never heard back from him. Probably for the better.
- mrfusion 8y agoI’d say that’s 60-80% of interviews. Especially group interviews. Everyone’s first priority is to look smart.
- aantix 8y ago10 Tricks to Appear Smart During Meetings https://medium.com/conquering-corporate-america/10-tricks-to-appear-smart-during-meetings-27b489a39d1a https://medium.com/conquering-corporate-america/10-tricks-to...
- scarface74 8y agoThat tells you a lot about the company. Even if he didn't yell at you and just spent a lot of time arguing about code style, it still tells you a lot about the company - that they are probably a lot of architect astronauts who are more concerned about minutiae than shipping software. Also a warning sign - applying for a senior level/architect position and most of your interview is spent writing leetCode and not discussing higher level concepts.
- cascala 8y agoTell a senior person at the company, or the Human Resources person you dealt with. Tell them what you experienced... this is unacceptable behavior and The hiring firm should know.
- stephen82 8y agoNo matter what type or kind of interview you go to, it is unacceptable to be treated like this, even if you have started talking nonsense or unrelated to the interview questions. This guy's attitude represents what is currently happening inside that company: the environment must be extremely toxic to work in and as the others have said, you have just dodged a bullet. In all seriousness, I wouldn't want to work for such a company, even if they paid me 1 billion dollars. Prestige and dignity above all mate, heads us!
- icedchai 8y agoI hate typing the same thing over and over... so, yeah, I'd use namespace std. However, for an interview, you are correct. This is something too trivial to mention or "get mad" at...
- w0utert 8y agoTyping is cheap. Debugging, reverse-engineering and refactoring is expensive. Taking shortcuts just because you don't like typing a few extra characters is a bad habit to have, it leads to the kinds of code that has obfuscated variable names, no comments, 'clever tricks' that put way too much logic in a single line, etc. I used to think like you, but I realized saving a few keystrokes is almost never worth it.
- icedchai 8y agoThe difference is name spacing is a feature of the language. It's not a clever trick or short cut. Would you fully qualify every reference then? I'd argue that would add more clutter and obfuscation.
- ifoundthetao 8y agoExcept when it comes to Vim. Amiright? jk But really though, this is solid, sound advice. And it's a great way to relate it back to business value. The extra half-second incurred when it comes to additional typing is going to be far less than the time saved when it comes to clarity gained from looking at the code again. Whether that be for future development, debugging, or whatever else.
- cheez 8y agoThey probably wanted you to fight back.
- cjhanks 8y agoGiven that your examples of using std::cout are using the wrong I/O direction, I am surprised you have "25 years experience of c++". Perhaps, that annoyed him too. Still, yelling doesn't help much of anything. Edit: OP changed post. Not fair to down vote....
- jason_slack 8y agoI made it up for brevity in case the interviewer lurks here and used cin but then removed lines. Thanks.
- blattimwind 8y ago> And he was just plain mad. Uncomfortable mad. "Good day to you. walks out"
- jb3689 8y agoLosing it any time at work is totally unprofessional. Don't work with these people. Moreover, interviewers go bananas over the strangest things sometimes. Just be reasonable and agree with or politely disagree with feedback
- btschaegg 8y agoTo answer your final question: No, I haven't. Lucky me :) I think there's multiple levels to this. 1. On a personal level: You clearly dodged a bullet. Also: > I didn't shout or get mad. I practiced my Buddhist learning and turned the other cheek without emotion. Kudos to you. 2. On a more organizational level: That's what style guides are for, end of discussion (a coherent code base is worth much more than individual subjective quibbles). Would the guy have been a professional, the answer should have been "you'll have to change the style to match our style guide, but that doesn't matter here". 3. On a technical level: I don't write much C++ code nowadays, but yeah, I also always use the std:: prefix. My reasoning would be this: - "using namespace X;" in a header is a no-go anyway (I don't think is negotiable). - In a .cpp file, I'd rather only operate in one namespace implicitly to avoid a giant mess of overloads. To the argument "compilers are amazing": Editors are not, I can guarantee you that much. - I never write code for std, since that's reserved for the standard library and STL. So, for me, there's no valid reason ever to use "using namespace std;". - On the "confusing" argument: I'd wager you'd never use std::cout directly except in very simplistic scenarios. Usually, there's either an abstraction (typedef is your friend there, if you want simpler names), or you write your own functionality on top of it (certainly not in the std:: namespace). Similarly, if one of your functions contains more than a couple instances std::<whatever>, it probably is way too big, anyway. But then, the technical level is the most subjective part of all of them.
- dagi3d 8y agoI am not c++ developer myself, so can't help on the namespacing decision, although a quick search on a project made by google, it seems they don't although I assume it will change from team/company to team/company who might have their own guide styles: https://github.com/google/flutter-desktop-embedding/search?q=std%3A%3A&unscoped_q=std%3A%3A https://github.com/google/flutter-desktop-embedding/search?q... having said that, the question here is not who is right but the unprofessional behaviour shown by the interviewer. I'd suggest to write to the company's HR or even to one of their c level managers and tell them about this situation. I think it's hasn't been the first time and that even this toxic behaviour is not a surprise within his coworkers.
- _Nat_ 8y ago> I tried saying "what if functions have the same name"..he spouted off about "how compilers are smart enough to know what the programmer wants based upon parameters provided [...] This sounds like a potentially challenging social situation! On the one hand, your preference for more explicit syntax has a lot of real merits, e.g. avoiding naming collisions as you've stated. But, if the interviewer's ranting and not quite willing to give due consideration, how do you handle the conversation (besides walking away)? I think I'd take it like this: 1. Let them vent a bit. 2. Make an analogy to [weak-vs.-strong type systems](https://en.wikipedia.org/wiki/Strong_and_weak_typing https://en.wikipedia.org/wiki/Strong_and_weak_typing). 3. Acknowledge the merits and opportunities to benefit from the interviewer's preference (which is analogous to weak typing). 4. Suggest why you feel that, despite their own position having merits, you lean toward stronger syntax in your own coding. 5. Point out that you fully understand the weaker syntax and would be able to use it if called for on-the-job. Since C++ is strongly typed and you're presumably interviewing for a C++-based position, you might focus on a consistency-of-design argument, perhaps gently putting forth the perspective that weaker syntax makes source code more script-like.
- tabtab 8y agoMany people have little things they obsess on, or at least over-focus on. That's just human nature. If you do something that agitates them, then chalk it off to random bad luck and move on. Everyone has their own code style preferences. Related: http://wiki.c2.com/?NarrowStaffSelectionFactors http://wiki.c2.com/?NarrowStaffSelectionFactors , http://wiki.c2.com/?StuckOnPetFactors http://wiki.c2.com/?StuckOnPetFactors
- alistairSH 8y agoAs an interviewer, I generally wouldn't care about style. Unless it was something really strange, in which case I'd probably ask about it to see if there's a good reason for the strange style. As an interviewee, like others have suggested, this is a serious red flag that you don't want to work there. So, in a way, mission accomplished.
- paul7986 8y agoRed flag for someone you don’t want to work with or under. They have no people skills.. treating people/those you work with kindly & respectfully is more important then your insecure ego & silly mad perfectionism(which is subjective & your Strive for your perfectionism just makes you look like a jerk unless your best buds with the head jerk).
- w0utert 8y agoWhere I work 'using namespace std' is explicitly forbidden, and rightly so for exactly the reasons you point out: there's way too many common names in std:: that could clash with our own code. More broadly, 'using namespace' is strongly discouraged except for our own namespaces. In all but a very narrow set of exceptions, we prefer to make it immediately obvious what functions are from external dependencies when scanning the code. If the interviewer finds adding explicit namespaces 'confusing', the problem is with him, not you.
- mpurham 8y agoGenerally never use the using namespace std given there are a ton of functions from std library that I do not need. I had a similar experience but, in a much friendly environment except I did the exact opposite. I actually wrote a blog post (https://marcell.me/using-namespace-std/ https://marcell.me/using-namespace-std/) about this last week, feel free to check it out
- sys_64738 8y agoDefinitely unprofessional and disrespectful for an interviewer to have a temper tantrum during the process. The nearest I've had is a manager who was angry in a 1:1 when I disagreed and blew a gasket. That just made me smile as I thought it was funny but I stopped him there and left the room. Nothing more was ever said of that meeting.
- rdiddly 8y agoIt's possible he was acting, trying to put you in a "high-pressure situation" to see how you'd react. If that's the case it sounds like you probably did OK. If on the other hand he was just being his normal charming self, then I guess you now know why they're hiring. Nobody hires because it's awesome; they hire because they have to. Which is because the last person quit. Which is because of this asshole. I've had rude interviewers, but never to the point of ranting like that. In the moment I mostly just keep going with the rest of the interview and make the best of it, but later on I always come up with lots of ballsy things I could've said. Including some version of the above like "OK I think I just found the source of your turnover problem" and point at the guy...
- flashgordon 8y agoYou actually hit the jackpot. You just found really quickly and cheaply where you do not want to work and why!!!
- lfowles 8y ago> Has anyone else had a horror interview like this? Here's my horror story from last year where the interviewer was getting frustrated at my mistakes in dictating C++ over the phone and abruptly cut off the interview with "It's clear you are not right for this position. Goodbye." This was for a hedge fund infrastructure dev position... I wonder if there's something in the water? https://news.ycombinator.com/item?id=17727794 https://news.ycombinator.com/item?id=17727794
- ryandrake 8y agoMost of the comments here are focused on the interviewer’s behavior. As for the code, I make it a policy to never, ever use “using namespace x” because of the potential of namespace pollution/confusion. Always prefix standard library identifiers with std:: I didn’t think this was even controversial. I also always use this-> to access members even when I don’t have to. Write things explicitly so there is no potential for confusion when someone else reads your code.
- JohnHaugeland 8y ago1) Your style of code is much more common 2) Even if it wasn't, either or, it's not a big deal. 3) That kind of behavior is not normal even in the presence of a serious problem. I would expect self control around a security flaw in production, let alone a triviality in an interview. Don't tolerate this. You're worth more than this.
- masmullin 8y agoI believe that the 'using namespace <xxx>;' is discouraged now-a-days. I believe the more preferred way is to be explicit by 'using std::cout;' for each and every function you want to "shorten/cleanup"
- kerrmudgeon 8y agoWere you able to complete the problem within reasonable time, otherwise? As an interviewer, I get frustrated if the candidate wastes time writing excessively prolix text while missing the meat of the question. This is by no means an excuse for hostile conduct, and the additional context here makes it clear the interviewer is kind of a jerk in addition to being narrow-minded.
- jolmg 8y agoI don't write C++, but in Haskell I always either list what I'm importing in the import declaration: import Data.Time.LocalTime (getZonedTime, localDay) or I qualify it: import qualified Data.Aeson as J That way any uncommon identifier that's not defined in the same file is easy to identify where it came from. If I see `J.Value`, I know it came from `Data.Aeson`. If I see `localDay`, I know it came from `Data.Time.LocalTime`. Yes, the compiler is smart enough, but I don't care so much about it as I do to the humans that read the code, including myself. > and why would any programmer use functions with the same name Because they would otherwise be resorting to Hungarian notation. For example, J.Value in my example above is for JSON values, but if I were to import: import qualified Database.Esqueleto as E E.Value would be for SQL values. Similarly, `Data.List.empty` tells me if a list is empty, while `Data.Set.empty` tells me if a set is empty.
- jessicatechexp 8y agoAs someone who have worked in quant firm when people are losing money they go mad. Usually, interviewer wanted to put me into high pressure/stress mode to see if i could still function rationally. Not everyone does, i also saw guys who choked or started bleeding or lost their temper and became violent literally when put under pressure. If the job has such environment - interviewer must test whether you fit in or you'll be better staying out of it for your own good. Cheers!
- rajacombinator 8y agoLot of pricks in this industry. Tell him to f off.