3 ms·
What are your thoughts on handwaving away "public static void main(String[] args)"? It's been a while, but when I learned programming initially, I remember bei
by albntomat0 6y ago
What are your thoughts on handwaving away "public static void main(String[] args)"?
It's been a while, but when I learned programming initially, I remember being told something along the lines of "This tells the program where to start. Copy and paste it for now, and we'll to what it means later on." If there was a way to get the best of both worlds, that would obviously be ideal, but IMO, this is a fine sacrifice for students being deliberate about the types of their variables.
Clearly new students shouldn't get crazy on types etc early on, but I'd definitely see someone trying '5' + 5 early on, or end up in a hard to debug situation like that. For example, returning a string from a function in one instance, and an integer in another. Instead of getting a failed addition at runtime later out and outside of function that causes the issue, the compiler can tell the student that they're returning a string, in a function that the student has explicitly stated returns an integer.
- jolux 6y agoMy CS prof taught Java similarly, even though I already knew it by the time I got to college. The distinction between compiling and running is nontrivial to understand, and I’m not sure how important it is right at the start. Python will throw a type error at runtime, Java will throw a type error at compile time. You can talk about what sorts of things you can do with strings and so on in a loose way without getting too in depth, for example. It may even help to mention them as types. But having the overhead of learning them first can often be too much, I think. Like I said, I don’t think this is the last word and I remain hopeful for better type-driven teaching strategies.