Show HN: I send out a weekly CS topic overview and code interview question
codingforinterviews.com
codingforinterviews.com
My preference, by far, is to spend time discussing ideas and approaches to solving problems. I don't want to see code. I want to see into his/her brain. How do you think? How do you slice and dice a problem to try to get to core? How good are you at intuitively choosing a good data representation? Do you bring-up alternative approaches to optimize for size vs. raw speed or other parameters? What questions do you ask?
Anyhow, whether the person can actually write two lines of code or not can be ascertained by looking at prior work (if available). The most interesting aspects of a programmer --the real reasons you might not want to let him(her) get away-- have nothing whatsoever to do with how quickly they can write a bunch of loops or if they have memorized five sorting algorithms. Nah, the real value is in how they think. That's what you want to hire them for.
EDIT: Some of the best, most creative and versatile programmers I have known could not write code without a set of reference books next to them. Why? Because they don't have encyclopedic knowledge of the various languages they might use. They'd excel at dissecting data to reveal structure and representation and then choosing a good approach to solve the problem but more often than not had to have a library of various CS and language books around them to support their work. My point is that these people would have failed interview puzzles yet they contributed to and sometimes single-handedly drove projects that generated millions of dollars for the companies that employed them.
I accept that when you're programming "for real", you have reference books, Google, StackOverflow and all sorts of other resources to help you out, and I accounted for that. I wasn't picky about syntax. I let them use whatever programming language they were most comfortable with (as long as it wasn't something terribly obscure, like Brainfuck or J) I even accepted the occassional algorithmic error (e.g. greater-than/less-than being flipped around) if it was clear that the applicant knew what they were talking about and was quick to fix the error once it was pointed out to them. But I still insisted on some code. I would be willing to bet that the programmers who you are referring to -- the ones surrounded with reference books -- would be more than able to bang out something like a quicksort or a binary tree without references. Sure, it might not be a perfect, production-ready implementation, but I'd expect something that at least resembles the correct algorithm, along with a discussion of the tradeoffs and edge conditions.
Frankly, I think memorization is, if anything, underrated in computer science. Our access to knowledge is quite similar to the memory hierarchy in a computer. Working memory is like RAM. Long term memory is like disk. Books and references are like the network. Having algorithms and data structures memorized is like having a local cached copy of a network resource. It allows you to be faster and more fluent when you're programming because you're not context switching constantly as you look things up. And just like in sports or martial arts, it doesn't matter what advanced techniques you know if you don't have solid fundamentals. Basic algorithms and data structures are the fundamentals of programming. When I ask a candidate to demonstrate their knowledge of such by writing code on a whiteboard, I'm assessing how good their fundamentals are. The rest can be taught.
EDIT: And of course, I forgot the most important fundamental of all: Big-O notation. Knowing algorithms is useless if you don't have solid basis for determining how and why one algorithm is better than another.
I ask them to write a method that takes a list of Strings and returns a single String which is all those Strings concatenated together with spaces in-between. And oh my word, how people fail. It's truly frightening.
I have never hired a recent grad for programming.
I used to own an electronics manufacturing company near UC Riverside (California) some time back. We had pick-and-place machines and the usual assortment of equipment you'd have for the assembly and testing of circuit boards. We made microprocessor-driven industrial motor controls.
During that time I thought it'd be great to hire engineering students. As someone who was a capable electronics hobbyist before I even touched college I assumed that these kids would be hell-bent to work in electronics as I was when I was in college. Not so. I probably went through 15 or 20 of them before I found a couple that were worth the effort.
When it came to programming I never hired anyone with anything less than five years of demonstrable experience.
Interview nerves are one thing but even if you're nervous you should still be able to do the equivalent of multiplying 5 * 10.
Most of them at least manage to get it working but don't necessarily cover all the problems that can arise and can get it to 100%, with some prompting.
It's a real joy when someone comes in who obviously loves programming. Like night and day.
return myList.join(" ")
or
return implode(" ", $myList);
or something similar?
Or maybe even
$string = ''; foreach($myList as $item) { $string .= $item." "; } return trim($string);
Or something more complex? I can't really imagine it being more complex, but I can imagine people failing. I too am sometimes shocked at how people end up getting programming jobs who don't grok extremely basic concepts.
I do understand how some people end up in programming roles - often just because they show some ability to get stuff done - they're the least bad in an org, and no one else wants to do it. But that's different that someone intentionally applying for a job as a "developer" and not understanding the concept of a loop (I've met a couple over the past 15+ years in the world of paid developers).
We were interviewing for Java devs so basically a method with this signature:
public static String concatenate(List<String> strings)
And I have a StringUtils class ready to go with an example method and say "imagine there are a bunch of methods in this class and we want production ready code"
There's a lot you can learn.
- do they decide to write unit tests up front (note that our questionnaire asks about their testing experience and everyone rhapsodizes about their strong testing background)
- if not, once they've written the method, how do they respond to the question "How do we know if it works?" (cue people writing main methods within the StringUtils class)
- what kind of unit tests do they write? Can they come up with good tests that cover all cases
- what names do they give to their methods/parameters/variables. (One guy called his method bangThemTogether)
- what bugs do they have - what cases do they miss
- if a unit test fails how do they go about fixing it (interestingly only 2 people fired up the debugger)
- do they ask questions if they need clarification
Minor things
- keyboard/IDE skills - do they laboriously type everything or have they taken the time to learn their preferred tool
- can they explain what they're doing - do they speak at all...
There's a second part to the practical - a bit of a code review/refactoring exercise. Sometimes I skip it because they've taken more than 30 minutes on the first part or their just so bad it's not worth continuing.
BTW we've interviewed about 30 people with this technique. They first meet with the dev manager for culture fit and general knowledge of dev processes. Then they meet with a tech lead for a more technical interview - explain your last project etc. Then I do the practical. Many people get through the first two just fine but fail badly on the practical.
- You're being misleading by asking them to write a concat method when you really want unit tests for that method. Just be straightforward. You're being too clever for your own good.
- People rarely code in a linear fashion. For example, I often write the meat of my methods first. Then do edge cases / error handling in a second or third pass. I have been dinged for this in interviews before. But imo, it says nothing about me as a programmer.
- You want them to be comfortable with tools, but they are behind enemy lines and under enemy fire. Dont expect them to achieve any kind of comfort level (and I would put 'thinking to use debugger' up there as something you would forget/ignore while being uncomfortable).
- When you are in extreme concentration mode, do you talk to others? Probably not. If you want them to talk, ask them questions. Again you're expecting them to read your mind. (also, keep them away from a keyboard if you want them to talk. Put them in front of a white board instead)
As others have said, talking to people and getting to know them and how they solve problems is much better than giving them mechanical interviews.
It's definitely not a failure. When a good programmer comes in, it's immediately obvious. They have no trouble. I mean, it really is basic stuff - writing a loop with a few if statements - not some fancy egg dropping puzzle or the big O notation stuff that Google gets you to do.
I do some PHP teaching, and one thing I got some good feedback from was giving students assignments that had asserts in them. Not quite unit-testing specifically (not using a full testing harness), but I'd give them some shell code with assert statements and they'd need to 'make it work'.
The sharp ones actually made it work, and gave me feedback that they appreciated that a lot, as it showed them how to think about breaking down things in to testable parts (even trivial stuff). The not-so-sharp ones... easier to spot when they'd give me back code that obviously was never even run in the first place.
Interestingly enough, you can do that with a single perl command, join. edit: nevermind answered as Java
You don't have to know everything about a language to solve problems in that language; if you need a set of reference books next to you for the languages you use every day, you don't know those languages very well.
And a good interviewer will help you with discussion, if you have a reasonable approach to the problem: "I think there's a function to do foo, but I'd have to check the documentation to find the details." "It's called foomod.foo_doer; it takes a baz and a bar." "Ah, thanks. scribble scribble". (Or, alternatively, "I'm assuming a function foo_doer to do foo, which I think exists in the standard library, but if not I could write it easily enough.")
There was a certain ethnic group who overwhelmingly aced calculus tests. I mean, they were machines. Got it done faster than everyone and just aced the tests. No contest.
The amazing thing was what happened in Physics class, both tests and labs. They were completely lost. It was really an odd and unbelievable thing to behold. Some of them would get tripped-up by the simplest things.
I won't venture to guess as to why and how this happens. I'll just say that, in my experience, mechanical memorization of anything isn't learning at all. It's just memorization with no value whatsoever beyond that.
I am trying to think about a CS example.
Let's say that someone memorizes the implementation of a binary GA algorithm or a NN. Great. They can type it out in an instant when asked. Do they really understand what's going on? Do they understand when to apply it, how and why? Do they understand how to optimize it? Do they know how to make good chromosome encoding decisions? Or how about dealing with cases where the GA is lost looking for a solution? Do they know how to fix it? Or how to deal with it?
Or how about the choice between writing a class with a bunch of methods and properties vs. a simple routine with lookup table to solve a problem? I've seen people who think that every solution requires a class and a bunch of objects. You end-up with code that is fifty times slower and ten times larger than it needs to be.
Some of this only comes from experience, of course. If available, I like to look at code that the candidate wrote and explore it. It's hard for someone to bullshit you if it isn't their code. Another interesting thing to do is to put code in front of them and see how they go about understanding what's going on. After all, if you are hiring them to plug into an existing project that is precisely what they'll have to do. Someone who can't code will not ask intelligent questions about the code they are looking at. They will have a hard time getting into it and understanding what's going on.
Now, I do understand from other posts that there seems to be a failure in the system in that schools are graduating people who can't write a program that prints numbers from 1 to 100. I can't figure out how someone can come out of a reputable university with a CS degree and not be able to write that program, but that's besides the point. If this is true, then, well, I hate to say this, puzzle testing may be a necessary evil. The problem is that this isn't enough because you don't know if you have a memorization machine in front of you or someone who really understands the topic.
EDIT: I should say that I couldn't imagine being a company like Google or similar and trying to hire large numbers of developers on a regular basis. I would imagine that at that level you don't really have an option but to apply puzzle type filters as a first line of defense.
Best of luck with it!
Also, any plans to monetize it? What are your long terms with the project, hopefully it will be something to keep you interested for a long time.
FYI: I had used http://www.careercup.com/ extensively.
except for the bad website and tons of ads.
Check it out at: www.InterTechTion.com
Thanks for reporting!
I'm not sure if it's my screen or fonts or something, but I thought you might like to know.
I'm excited to get these emails!
You do have some bugs to work out though, the UI isn't very consistent throughout the site and somehow I got redirected to here: http://interviewpractice.herokuapp.com/ and now can't see anything. I also had trouble the signup process and had to reset my password to join.