Hacker News new | past | comments | ask | show | jobs | submit login
Dhh: I would fail to write bubble sort on a whiteboard (twitter.com/dhh)
38 points by devnonymous on Feb 26, 2017 | hide | past | favorite | 33 comments

There seems to be a growing and vocal subgroup of programmers who think solving algorithm problems is about memorization. That worries me. Don't they understand that problems can be solved by thinking? That they're being asked about the most timeless and beautiful parts of programming, which don't depend on the technology of the day, and whose beauty is that you can figure out everything from scratch? Or that solving such problems gave us computers and the internet in the first place?

...I must be getting old. I have nothing but ugly things to say about that attitude. Sorry, HN.

Current interviews don't really encourage critical thinking. If 2 candidates are given a question, and one can regurgitate a memorized algorithm immediately, he's probably the one to get the job. Plus, nerves and time pressure make it nearly impossible to solve algorithms on the spot.

I found it infuriating at my google interview when I tried to pause for a minute to reason through the question (out loud) and my interviewer started prompting me with hints and pieces of the answer. It was obvious that I was losing points because I hadn't seen the question before.

It seems like companies are okay with this system anyways. MIT literally offers a course called "Hacking a Google Interview", and yet Google still hasn't changed their internship interview problems.

If a candidate doesn't know what "bubble sort" is, they cannot implement it without having it described to them first. If you have to describe the algorithm to the candidate, then what is the point of them asking for an implementation? The implementation is the description in code form. A better test might be to give the candidate a bubble sort implementation, and ask questions about that specific code, like what the "big O" is.

Unless you specifically work in a scientific environment, when do you ever solve problems using a novel, non trivial algorithm designed by yourself? An amazing amount of programmers are simply doing CRUD, batch processing, and mapping data from one format to another. It's not rocket science.

I'd bet that ~99% of programmers never created a new algorithm, or needed to. And that's fine. (where by new algorithm I mean an actual, unique solution lowering the bounds on some operation which is usually done in a simpler way) Outside of what's happening in ML research, I can't even think of recent known examples.

Also see Keith Devlin's essay: In math you have to remember, in other subjects you can think about it at http://www.maa.org/external_archive/devlin/devlin_06_10.html

How many times do you think bubble sort was independently invented?

you aren't alone.

recently, I was constructing a small query engine based off of Prolog, a language which I have never delved into the internals of.

the rewarding moments were when it worked. I didn't work off of any documentation, only by thinking how I'd design something similar. going "from scratch" is incredibly rewarding because you start realizing that some parts of your thought are based on well-trodden ground. things start to light up.

I'll never get tired of that style of work.

The first twitter response is pretty great IMO "Hopefully we won't get to the point where people take as much pride in ignorance about CS as they currently do about math."

Maybe you don't use bubble sort, but it is truly trivial and these arguments seem quite anti-intellectual.

I don't think it's pride in ignorance as much as pointing out how disconnected the hiring process is from the work being performed.

I think the point is that memorizing bubble sort doesn't prove anything.

I might have trouble remembering the difference between bubble sort and, say, selection sort off the top of my head. On the other hand, I can implement insertion sort from scratch. It is so simple I do not need to remember the algorithm, I can just figure it out whenever I want.

I think there is a problem with the industry having forgotten the point of why we were asking questions like this in interviews in the first place. The question is not whether you can remember the algorithm, it's whether you can implement such a simple algorithm in any programming language that both the interviewer and interviewee know.

Since the point is the implementation, not the memorization, even simpler algorithms than bubble sort might well make more sense. This is why we've got FizzBuzz for example.

As an alternative, the interviewer could take a moderately simple algorithm like say the Fisher-Yates shuffle algorithm, explain it to the interviewee on the whiteboard, and then see if they can implement it. But again, the point is not to test the interviewee's memorization skills. These algorithms are simple enough that any software engineer who can actually program should be able to implement them from a diagram and some textual/verbal explanation.

The question of coding on a whiteboard vs coding on the computer is a separate question.

Could you implement insertion sort from scratch at a whiteboard in less that 45 minutes? Including getting the partitioning part right? It's tricky, and at a whiteboard, it's particularly difficult to get right (well, for me it is).

If you can, well, hat's off. I'd have to study and be prepped for this. I probably could have done this in the past, but I don't walk around ready to take my algorithms and data structures final exam from 15 years ago. That's the thing I don't want to do anymore. I feel like I've taken that test enough times.

I'm pretty sure I'm all done with tech interviews. I'll look for some way to stay in the field that doesn't involve another 5 hours of whiteboard exams. There are other options. I'm aware that I have ruled out some possibly good opportunities, but I truly can not stand the idea of going through this all one. more. time.

If it were just bubble sort or even insertion sort, eh, that wouldn't be too hard. I've only interviewed at google once, but I felt the questions were far more complicated and difficult than simply implementing insertion sort, and as far as I can tell, you really are expected to make good progress and write a lot of code. That was the reason they give for the "no hire", that I hadn't made enough coding progress on the problems in the time allotted.

This is certainly their right (though I do get irritated when google lobbies congress to remedy the shortage of software developers, as if their recruiting and hiring process isn't part of why they're having trouble hiring!)

But me? Yeah, I'm out. No more whiteboard oral exams, no more uncompensated "take home projects". Done. If this were part of some sort of professional certification, widely recognized in the industry, that I could properly prepare for and take as a lasting, industry respected credential, then I'd do it. But no more tech exams or take homes at the whim of a potential employer. I've wasted enough time on this.

> Could you implement insertion sort from scratch at a whiteboard in less that 45 minutes? Including getting the partitioning part right? It's tricky, and at a whiteboard, it's particularly difficult to get right (well, for me it is).

I think you have confused insertion sort with quicksort. Let me stress that not only would I have difficulty doing quicksort correctly in 45 minutes on a whiteboard, I'd have difficulty doing it in twice that time on a computer. And for exactly the reason that you specify -- the partitioning part of the algorithm is very hard to get right.

Insertion sort, on the other hand, is a breeze.

It might be reasonable to ask somebody to code the recursive part of quicksort assuming that they already had a function to do the partitioning part. This might be useful to see if they understand recursion.

> But me? Yeah, I'm out. No more whiteboard oral exams, no more uncompensated "take home projects". Done. If this were part of some sort of professional certification, widely recognized in the industry, that I could properly prepare for and take as a lasting, industry respected credential, then I'd do it. But no more tech exams or take homes at the whim of a potential employer. I've wasted enough time on this.

I've never had a big gripe about whiteboard coding exercises, but I'm with you on the take home projects.

My big complaint right now is that it has become increasingly difficult to get through the first level of screening to even get to a proper interview loop where someone could even ask me to code on a whiteboard.

You're right, I did mix up insertion sort and quick sort.

The problem is that it's impossible to get an idea of someone's problem solving skills by feeding them artificial bullshit to solve. I strongly prefer the approach of having applicants show and discuss real code that they wrote themselves. And I'd consider not having any code to show a serious warning sign.

These kind of coding questions aren't about the interviewee's "problem solving" skills. It's purely a question of basic competence in the field. If it's general problem solving capability you're after, then you're right, there are much better ways to do that. In the case where a job interview involves multiple one-on-one interviews, it might make sense to have one interviewer focus on basic competence, and another interviewer to focus more on more general problem solving skills.

You might think we ought to be able to assume a basic level of competence, but lots of people in the industry think you can't. And to the extent that you can, that's often because the person sitting in front of you in an interview had to get through an initial online screen where they had to do some sort of coding exercise.

Asking about bubble sort is a terrible question, though. Bubble sort is a bad algorithm by virtually every measure relative to the alternatives. You might as well ask candidates to implement bogo sort.

But whiteboard coding says nothing about basic competence, unless writing algorithms on whiteboards is the actual job to be performed.

It is not about ignorance. It is about self-awareness.

Similar problem: "Most programmers think that with the above description in hand, writing the code is easy; they’re wrong. The only way you’ll believe this is by putting down this column right now and writing the code yourself. Try it." https://reprog.wordpress.com/2010/04/19/are-you-one-of-the-1...

Also, how often do you write complete implementations of anything on the whiteboard at work and therefore how useful is this skill?

I recently experienced this filter when I applied to one of the big tech companies without bothering to re-memorize my undergraduate-level algorithms. I figured having run two companies and fifteen years of industry experience with a dozen languages was good enough.

I didn't get an offer. But the filter worked: I wouldn't have been happy at a place that places value on the ability to memorize and regurgitate search results.

We just raised a seed round on the back of a deeply technical demo I wrote in my spare time.

While I think the focus on knowing undergraduate level algorithms verbatim and gotcha riddles are silly and a waste of time, they're exaggerations of very useful techniques. Something like fizz buzz is simple enough and trips up a surprising number of people that were able to talk their way into the interview. Puzzles allow you to assess their critical thing skills without letting them get caught up in semantics that tends to happen if you make it about programming (too many questions about libraries, coding style, etc).

An immediate answer, even if correct, tells you nothing because it was something they memorized. I'm much more interested in how they assess and approach--I don't even care if they come up with an answer.

Completely unstructured interviews seem to be meandering and often you walk away with gaps in your assessment.

This approach is only really applicable to jobs where those skills are needed and isn't the whole interview.

How many times in your career have you needed to implement bubble sort without the ability to google it? In my experience I can say never and imagine that's what other people would say too.

I don't think the point is that we should take pride in not knowing things so much as that perhaps this way of evaluating potential hires is not very good. Doesn't seem controversial to point out that doing a technical interview that tests skills not required on the actual job might not work well for finding the people you need.

I want to hire people that can write robust, maintainable software. Unfortunately, I do not know how to test for that. At my company we do not do algorithm quizzes because, for better or for worse, algorithm mastery is not really important for most of our work. We mainly talk about work experience in the interview.

While I don't think you should know how to implement bubble sort on the fly in an interview, you should probably understand what it is at a conversational level, along with merge sort and quick sort, especially if the position is senior or lead and requires a CS degree.

I think that's just a bad substitute for the real question: What's the big-O notation, how do algorithms differ based on the CPU / memory usage and existing data format. Nobody uses merge/quick sort as originally defined anyway. In reality it's going to be some mix of algorithms with a threshold.

So why not ask what you really mean by either asking the theory (big-O), or real world practice (you're adding a number to a large ordered data structure - how would you do that, what's the chosen structure, tradeoffs)

If you're hiring for "great", you need to realize it is a two way street.

As an employer, if you really think a white board quiz is the best way to see if you want to work with someone, ask the candidate to bring a couple of questions for the interviewer to solve, you know, so the candidate can tell if they want to work with you.

An interview is a date - you want to find out if you're compatible without coming off as a jerk.

That said, white board stuff never bothered me. I don't remember caring that much if I got the job and talking to other developers is kinda enjoyable.

Fwiw I think the emphasis on the ability to write code instead of ability to read and understand it has been given disproportionate importance when the reality is that we spend a lot of time (perhaps even more time) reading rather that than writing.

I blogged about this at length here: http://lonetwin.github.io/blog/html/2016/07/01/code_reviews_...

Does anyone agreeing with this tweet know what bubble sort is? It's fine if you don't but if it's explained to you it should be pretty trivial.

It's like saying "why should I have to write fizz buzz for an interview." Of course you'll never have to write it. You won't even have to use it.

I just need to know if you can write software at all for this software developing job you applied for. Sure, we'll evaluate other, more important, things too.

Looks like this is related to https://twitter.com/cyberomin/status/835888786462625792, which is a bit different. So nevermind.

they could just as well ask to do multiplication without a calculator. many programing languages already have a sorting function in its standard library.

Agreed, the stupid quiz culture is getting old. I suspect people who cling to this tradition wouldn't be able to code their way out of a paper bag outside the sphere of well defined problems with canned solutions.

Or the hiring process is optimizing for "nerd culture", whereas most development is optimized for solving business problems, and the two are often at odds.

If the desire is for peers rather than coworkers, you might as well ask, "In which Marvel parallel universe did Wolverine have claws made out of banana peels instead of Adamantium?"

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact