I am soon going to try and give a Julia tutorial in my research group (cognitive neuroscience). It will be for people mostly acquainted with Matlab and R, maybe a few people with some Python experience. I’m therefore thinking a lot about angles from which to show Julia which might appeal to non-programmers. I think there’s real value in Julia for my colleagues, but at the same time I’m already building a mental model of all the pitfalls and problems that we’re going to encounter in a tutorial, and how I can have the experience not be overshadowed by them.
Personally, I’ve gotten used to many of these quirks and their workarounds, but I wonder what can be improved here. What I find especially interesting is how much the language explains itself to the user when errors appear. I would call any of such measures “hand-holding” because that’s what beginners need and it’s also what more experienced users don’t worry about.
One example (maybe not a very good one but you’ll get the gist):
When trying to redefine a struct
MyStruct you get this error:
"invalid redefinition of constant MyStruct"
So for a beginner who’s poking around in the language, trying to test out a few things, does this explain what’s going on? Are we dealing with a redefinition that has invalid content? If so, why? Or is it invalid to redefine it in the first place? Why
constant when I wrote
A hand-holding version could be:
""" Tried to redefine MyStruct. Changing the definition of an existing struct is not allowed for performance reasons. For details check http://julialang.org/some-page-with-explanations """
Obviously this can’t be done for all error messages, but maybe for the top problems that people struggle with when they learn the language? I can imagine that many people here feel this is unnecessarily verbose and should be obvious once you read the documentation. I’d argue that it’s exactly this kind of hand-holding that makes a language like R and the tidyverse so popular. It’s not raw performance that attracts people but the overall image that they get, the ease of use. And I’d argue any effort spent on beginners is worth it, because they turn into users or contributors. Contributors bring new packages and users bring funding eventually. (I sometimes see the argument that people who really have no skills in programming are maybe wrong here and should stick to R or Python, but that’s exactly how you get so many people trained in these competitor languages from an early level).
So I was hoping for others to chime in and list instances where basic things in the language could be made more beginner friendly. A pro can always ignore a longer error message, but if it’s too short or vague the beginner gets stuck.