56

Let's suppose that at a job interview they ask me "what you do if your code does not work?".

I tell them that I read the docs to look for the error, I isolate the piece of code that doesn't work and try to change it to make it work. But in the end if I can't find the answer I ask on Stack Overflow.

Would this be self-defeating?

2
  • 1
    Comments are not for extended discussion; this conversation has been moved to chat.
    – Neo
    Commented Nov 14, 2019 at 16:29
  • 1
    Why did the comment about the title edit got removed as extended discussion? It completely misrepresents the matter of question. OP clearly does not mean to use Stack to find errors but to understand them. "Where is bug in this code?" is essentially different from "Help me understand this code."
    – luk32
    Commented Nov 15, 2019 at 9:35

8 Answers 8

168

What they are looking for is that you have a reasonably systematic approach to locating and solving a problem, over and above simply staring at the code, and a range of techniques and resources that you are familiar with that you can turn to. That could include any of:

  • writing tests that characterise the problem
  • adding logging / telemetry that will give you more information about the problem
  • refactoring difficult code to make it easier to reason about
  • pair/mob programming with colleagues on the problem
  • asking relevant questions to experts (which includes Stack Overflow)

A poor answer might be just hacking around until the code magically works, or using SO as the first line of defence. SO is just one tool in your toolbox, demonstrate that you know when it's the right time to use it.

(As an aside, if they don't like you using SO for seemingly arbitrary reasons, beware!)

10
  • 35
    I upvoted this because it hints at the underlying criteria the interviewer is likely using to evaluate answers. There's a balance in troubleshooting techniques. On the one hand, interviewers don't want someone so reliant on outside help that they can't think for themselves. On the other hand, they also don't want someone who is so headstrong and independent that they waste time striving to figure everything out on their own, when there may be quick help available from others. There's nothing wrong with saying that you'd ask for help online, but you need to put it in context.
    – dwizum
    Commented Nov 12, 2019 at 15:01
  • 4
    Searching for a solution on Stack or similar makes sense as you can often find a peer reviewed solution to a common problem; however, it's also important you research the suggested solution to make sure it is appropriate. How you do that research could be a part of the answer.
    – David
    Commented Nov 12, 2019 at 18:19
  • 2
    Searching SO is perfect for a first option when the question you have is "What does this error message mean". Sometimes the answer online will directly give you the solution and sometimes it will give you enough information to go back to the problem understanding what happened.
    – Qwertie
    Commented Nov 14, 2019 at 0:57
  • 8
    @TimothyAWiseman it's one thing to search SO as a first step, but asking a question on SO should never be your first instinct.
    – Kat
    Commented Nov 14, 2019 at 22:11
  • 1
    Usually isolating/formatting/explaining a problem to present to SO points out what my problem actually is, which I can then fix - even before submitting it to SO.
    – Arluin
    Commented Nov 14, 2019 at 22:12
34

It depends. If you were interviewing with someone like me, it could be a mark against you, but I go all the way back to when the internet was text-based and you had to telnet into a BBS if you wanted to do anything.

If I were interviewing you, I might ask some follow up questions like:

  • Why wouldn't you ask a coworker?
  • How would you ask a question without revealing company information?
  • Why wouldn't you be able to find an answer on your own, instead of asking questions.
  • Ok, you ask a question on SO, and someone gives you an answer. What happens when that code breaks?

I would be concerned that you wouldn't be writing your own code, but cutting and pasting snippets of someone else's code, and thus wouldn't know how to maintain that code. I come across this more and more frequently these days. The worst case scenario is we end up with a Frankenstein's monster of lumbering spaghetti code that nobody knows how to maintain.

So, a better answer would be:

I isolate the piece of code that does not work and try to change to make it work, then I step through the code. If at that point, it still doesn't work, I would check online to see if if I can find any articles discussing that issue. Failing that, I would consult a coworker, as a fresh pair of eyes often helps

or something like that.

The point being that you want to demonstrate your thought process. An answer like that would demonstrate to me that you have problem solving skills, and try to solve your problems on your own before going out to find answers, and then consulting with others as a last resort.

That would show me that you are both independent, but not to the point of being too proud.

2
  • 1
    Comments are not for extended discussion; this conversation has been moved to chat.
    – Neo
    Commented Nov 14, 2019 at 16:29
  • 1
    Tangential but I'd like to say it: Pasting code you don't understand is unlikely to happen when you ask the question. Asking the question means breaking it down enough that a total stranger can understand, reproduce, and answer it. Often, formulating the question alone gives you the answer. The problem lies more with copy pasting code from existing questions/answers
    – lucidbrot
    Commented Nov 15, 2019 at 14:56
14

There is no right or wrong in this case, it's a matter of perspective.

I don't see mentioning about known online communities to be a problem, however, you may want to keep it a bit more generic (not to paint yourself as someone with no individual knowledge and fully dependent on Stack Overflow or other communities for coding, testing, debugging or troubleshooting).

Don't directly say something like "I post/ask on site", because it involves the risk of possible data/code leak, you can say something like

"If I'm hit with a roadblock that I can't seem to overcome after initial debugging attempts from my side, I look for answers available in online technical communities and forums, like Stack Overflow".

9

It’s a good idea to write a question for stackoverflow where you precisely describe your problem. That’s because precisely describing your problem very often leads you directly to the solution. Obviously you are not going to post that question.

It’s a good idea when there is third party code involved that you don’t understand and that is badly documented and you need help from someone who understands it.

For finding bugs in your code? I would seriously doubt your qualities as a software developer.

2
  • 4
    The number of times formulating a problem in an approachable way (like a good SE Question, or a question for a colleague who doesn't know the ins and outs of my code) provides the very solution to the problem (usually by highlighting an oversight) is quite high. That's why I keep a rubber duck on my desk.
    – Baldrickk
    Commented Nov 13, 2019 at 15:14
  • Fixed. Annoying feature that only the author can make a two character change. When only two characters are wrong.
    – gnasher729
    Commented Nov 17, 2019 at 0:19
6

If the qualities they are interviewing for include honesty and pragmatism, then telling them this will reflect favourably on you.

You obviously have to gauge if this is a "what's your actual workflow on the job" or "demonstrate your skills and knowledge in a somewhat artificial way for the purposes of the interview" type question.

But if it's the former, and that's what you really do, then just tell them that.

In interviews I find it's best to be as honest as possible, for both parties. This means if you agree, then it really is likely to be a good fit. Also interviewers often appreciate straightforwardness and humility, as they can be somewhat rare to see in a situation which doesn't generally encourage either.

Think of it from your point of view as well - if this is how you work, and they find it an unacceptable practice for some reason, would you really be happy there?

6

In my experience, when interviewing potential candidates I always watch out for people who DON'T mention Stackoverflow (or similar). I have a tendency to hire those that put SO at the end of the list of solutions to a problem, not those who put it first.

As noted by others, SO is one tool in a developers toolbox. It shouldn't BE the toolbox. But it should definitely be present.

As a senior developer it'd be hypocritical of me to criticize other developers use of SO as I'm here at least once a day. One rather embarrassing moment for me was when I spent ages looking up the answer to a solution only to find the answer, which I had written here myself months before.

3

I would ask to see some of the questions you asked, since they are public record. In your particular case, your questions seem well-structured and focused, and are not the sort of thing that's easily googled or that a colleague would necessarily know. I would consider questions like that to be a positive on your job application (although I might have some follow up questions about using excel as a data source).

However, not everyone is going to go to the effort, and they may unfairly lump you in with some of the lazy questions they have seen on the site. Also, I would want to know more about your process for troubleshooting before it gets to a point where a StackOverflow question can be written. How do you narrow down the problem? How do you gather the appropriate context, etc. Don't leave an impression that StackOverflow is your first and only resort.

1
  • That! Looking at a question will give significant insight on general level of knowledge as well as ability to research/communicate. If one can't show any because "I delete them when I get answers" is also tells a lot... Commented Nov 14, 2019 at 2:30
2

In an interview, I'm looking for people who can take advantage of any available resources to achieve their goal more efficiently/effectively.

If you were to say to me "When I get an exception, I sometimes post it on stack overflow to see what the problem is", I'm going to take that as a negative without additional context. It implies you don't know how to debug code.

Conversely, if you were to say "I often use SO to cross-reference, or research potential alternatives", that's a positive - it shows you've understood the problem, and are evaluating multiple options for resolution.

The one thing I don't want is someone who's going to keep reinventing the wheel. If someone's solved this already (and the license is appropriate) use it! You just saved yourself days/weeks of time, and helped make sure the project is delivered on time and under budget.

Also.. If you mention SO... Are you proud of your question/answer history? If so, consider including a link to your profile on your CV.

As an employer, seeing how someone approaches problems (and takes feedback/criticism) can go a long way to giving a fuller picture of a candidate.

We have one employee who completely bombed in the interview. Really didn't demonstrate any of the skills we were looking for but his SO profile was thoughtful, detailed and showed a huge breadth of knowledge. So we gave him another shot (and some written work) and he aced it (and we're very happy with him).

I can't say we'd have taken him on the profile alone, but it was enough to make us stop and look twice.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .