>Would you hire an engineer who couldn't write a FizzBuzz without looking it up?
Yes?
I mean, even after 20 years of writing code professionally, I still don't remember the exact syntax for main methods for each language. Is it public static void main(String args[]) {} for Java, or is it something else? Will I remember that even when I've mostly been coding in Golang this week? Probably not.
It is public static void main(String args[]) {} (inside a public class with the same name as the file). Alternatively, you could do public static void main(String... args) {}; that would also work, probably because it's compiled down to the same thing in the JVM. (It doesn't work if you have named string arguments before the varargs, so it's unlikely it's meant to work.)
I don't remember any of this. I don't remember that it's int main(int argc, char *argv[]); in C, or fn main() -> Result<(), Box<dyn ::std::error::Error> {} in Rust, or package main \n func main() {} in Go; I derive it anew each time based on my understanding of the language.
And I wouldn't hire me to write C code, because I can't remember where the `const`s go. All I remember is that you shouldn't really use them here, because you're expected to be able to modify argv (and sometimes you have to, e.g. to redact passwords that somebody foolishly provided on the command line). And I remember that #include <stdio.h> lets you use size_t, but don't ask me why.
Then again, I guess I'm proving your point. I could write fizzbuzz easily in C – perhaps more easily than in any language I'm good at – but that doesn't make me a good person to hire if you want a C programmer.
Yes?
I mean, even after 20 years of writing code professionally, I still don't remember the exact syntax for main methods for each language. Is it public static void main(String args[]) {} for Java, or is it something else? Will I remember that even when I've mostly been coding in Golang this week? Probably not.