To me a decent junior should be able to build a basic Hacker News.
There are a lot out there who have never done so much as make a web page with more than copy/pasted Jquery and expect to get jobs.
On the flip side, self taught coders can do pretty much anything with bad form. Although even at my job I find myself doing things with bad form unless the task requires it to be written well.
I have never really had the opportunity to work with experienced developers for a long period of time (at least not experienced with the work I was doing) so for all I knew I am doing all sorts of things with bad form.
In what time period? With what features? With what non functional requirements? Show me a senior who can!
I have a better test for evaluating anyone's skills:
Write a function that puts Strings in an array. Then write another function that goes searching for a string in an array.
Write a unit test to confirm your code is working. Explain what happens to the performance of our code if we can guarantee our array is sorted.
If they can past this test, you're already better than most candidates in my eyes, and it takes about 10 mins to find out.
If you know enough about a web framework to get it going, use it to complete a specific set of tasks, and get it deployed with a database, it would put you ahead of a heck of a lot of grads that I know.
I wasn't suggesting this as an interview question, but more a self check for juniors. Can you actually bring something end to end? Yours works better in an interview setting, although it seems fairly trivial.
fn put_string(array: &mut Vec<String>, input: String) {
array.push(input)
}
fn find_string(array: &[String], input: &str) -> Option<usize> {
for i in 0..array.len() {
if &array[i] == input {
return Some(i);
}
}
None
// or perhaps more idiomatically:
// array.iter().position(|s| s.as_str() == input)
}
#[test]
fn test_find_string() {
let mut array = vec![];
put_string(&mut array, “foo”.to_string());
put_string(&mut array, “bar”.to_string());
assert_eq!(find_string(&array, “foo”), Some(0));
assert_eq!(find_string(&array, “bar”), Some(1));
assert_eq!(find_string(&array, “quux”), None);
}
If our array is sorted, the performance of the function should improve due to better branch prediction. But we’d be better of rewriting it as binary search in that case.What kind of salary are you offering?