In my experience, immediate feedback is helpful in speeding along development, but rarely enhances understanding. In fact, I am often frustrated with the immense level of help that is provided to my strugglers, because they wind up moving words around until whatever they've written stops being underlined.
The only exception to this has been for norms that don't cause errors, such as using CAPS for static final
variables in Java. In those instances, it is very helpful to have some sort of indicator that what they've done isn't perfect.
Edit: Now that I've seen your edit with examples, it seems like what you are contemplating is basically all of the stuff that I feel is helpful. In which case, I believe that it could be very helpful!
manpreet
Best Answer
2 years ago
Do automatic style hints (like those provided by linters) significantly increase the student's understanding of the language they're learning? I am asking because I assist in a course that uses a language that is not widely used. A linter does not exist yet, and I'm wondering whether it would be worth the effort to make one.
Also, does it matter whether the style hints are provided as you type rather than upon saving or compiling the program?
I would love to see quantified studies about this, but personal experience is very welcome too.
Some things I am thinking about for a functional language (examples use Haskell) are listed below, but these are not vital for answering this question. Experience with other paradigms is appreciated as well!
When parentheses are(n't) needed. A common faux pas is to surround every application of a constructor with parentheses (
(Just 5)
), even when they are not needed, because it is necessary in pattern matches.Writing
int
instead ofInt
, making a type variable instead of a concrete type.Using
where
clauses for helper functions.Suggesting pattern matches where guards where used (i.e., not checking
| x == 5
but using a pattern match wherex
is replaced by5
.Recursion that may not terminate. For instance, students tend to get confused writing functions that get no parameters, and end up writing things like
instance minBound ... where minBound = minBound
. (Not really a style hint)