15 ms·
It's curious the article didn't propose solutions. > Confusing short-circuit logical operators > Using == instead of .equals to compare strings. These probl
by ryanianian 5y ago
It's curious the article didn't propose solutions.
> Confusing short-circuit logical operators
> Using == instead of .equals to compare strings.
These problems are more typo/syntax-based rather than logic-based.
> Ignoring the return value from a non-void method.
This is more logic-based but also something that IDEs or other static-analysis tooling can usually spot (I wish java had `[[nodiscard]]` but alas).
You can certainly say that Java's syntax is an additional layer of complexity to beginners, and this syntax can make it hard to see the forest for the trees.
But any language or learning environment is going to have its quirks. I wonder if the real problem here is trying to teach programming in a total vacuum. I.e., not also teaching how to program using a competent editing environment and teaching how to use its feedback to solve problems.
I taught myself PHP at 13 using only Windows Notepad uploading to the server and refreshing every change. The concepts of an IDE, a syntax-aware editor, or a local development environment never occurred to me despite having read plenty of examples and explanations.
I don't know if the teaching/discoverability situation is any better in general now, but in my teaching I spend the first lesson showing how to type, do editor things, and look at feedback in VSCode before I explain even the first thing about syntax or programming. I would hope that teachers of beginners would show some tooling that gives students direct and actionable feedback.
- wirthjason 5y ago> These problems are more typo/syntax-based rather than logic-based. This! I was hoping for a list of logic and organization / structure errors. On the idea of editor feedback, one thing I find frustrating is that hardly anyone teaches how to read error messages and stack traces. That’s the most important thing because as a beginner you make tons of errors and you see them a lot! Books and tutorials don’t show any errors, so when you inevitably make one it’s hard to figure out what exactly you did wrong.
- AnimalMuppet 5y agoThis is novice programmers. They aren't writing big enough programs for organization/structure errors to matter much. They could have logic errors, but this kind of stuff is the fluff you have to get out of the way before you can start showing them the logic errors. There's kind of a sequence: - You didn't say what you meant (this kind of error) - You said what you meant, but you meant the wrong thing (logic errors) - You said the right thing, but in the wrong place (organization/structure). With a novice, you might need to work through them in approximately that order.
- wirthjason 5y agoI’m not sure what “novice” means. I certainly know when I was beginning I glossed over stack traces because they were a giant information dump and I didn’t know how to read them. They tell you exactly what’s happened, the call, what line it broke, what the local variables are, how it got there, etc. But it’s like reading a foreign language and is intimidating for a beginner. IDEs help a lot but once you know how to read a stack trace it’s easy to understand if you made a typo: AttributeError: Person object type has no attribute “helo” …or have a bug: AttributeError: None type has no attribute “hello”
- denton-scratch 5y ago> I’m not sure what “novice” means. It took me 15 years to convince myself I was no longer a novice. I've been at it for 40 years now, and I still don't think I'm anything like a master of the craft, nor ever will be.
- tsumnia 5y ago> These problems are more typo/syntax-based rather than logic-based. Interestingly enough, syntax-based mistakes are often the first hurdles students encounter in programming, as described in Altadmri's paper. They also go on to observe that these mistakes do subside as the semester progresses as students "get used" to syntax, while logic-based errors will persist. While editors can provide some benefit to these issues, they can also be rather complex; often designed for industry rather than education. However these issues persist even with BlueJ, the IDE used in Altadmri's paper, which is an education-focused development environment. My current research on the topic encourages the use of lower-level exercises (even typing exercises) with CS examples to help students get familiar with coding's syntactic structures without problem solving [1]. As a result, students are struggling on correctly solving the coding problem while struggling to correctly implement the syntax necessary. My recommendation is to rather provide additional practice opportunities that isolate these lower level skills so students aren't trying to problem solving AND refine their skills at the same time. In addition, these lower level exercises can provide students with additional examples that can be more beneficial that simply showing them code snippets [2]. These examples can help serve as 'templates' that students can refer to when they encounter similar problems. [1] https://dl.acm.org/doi/pdf/10.1145/3373165.3373177 https://dl.acm.org/doi/pdf/10.1145/3373165.3373177 [2] https://educationaldatamining.org/EDM2021/virtual/static/pdf/EDM21_paper_88.pdf https://educationaldatamining.org/EDM2021/virtual/static/pdf...
- ryanianian 5y agoThe typing exercises remind me of 80s/90s computer magazines having basic/asm code for interesting programs or games. You had to retype them to run them. It was slightly before my time, but I suspect a large number of people got through the "learn the tooling" stage simply by retyping, looking for the mis-type when they got it wrong, and learning how to understand the feedback. The natural next thing to do is to try to change some values and see what happens. All of a sudden you're learning how the whole program and environment work together and can always go back to a known good state by retyping what the paper says.
- tsumnia 5y ago
- david_allison 5y ago> (I wish java had `[[nodiscard]]` but alas). Try Google's Error Prone: https://errorprone.info/bugpattern/CheckReturnValue https://errorprone.info/bugpattern/CheckReturnValue Or @CheckResult in Android-flavor Java
- 908B64B197 5y ago>> Ignoring the return value from a non-void method. Beginners might also write a method/function with a return parameter they don't care about (or that they sometimes don't care about) but that has some desirable side-effect.
- tsumnia 5y agoA common issue I've seen is more the return is replaced with a print statement. As a result, their code "appears" to working because they're still seeing the right values appear in their console when they run the code. If the function's returned value doesn't get used somewhere else, then they don't see where the issue is until points are deducted.
- opheliate 5y ago> > Confusing short-circuit logical operators > Using == instead of .equals to compare strings. > These problems are more typo/syntax-based rather than logic-based. Sure, but you can also see why it could take absolutely ages for a novice to work out what's wrong, right? The bitwise operators will work for evaluating logic like this in some cases, but not all. And the student knows it's something like "&" for "AND" and "|" for "OR". Could be a really tricky bug if you've been introduced to logical operations, but not bitwise ones, and don't therefore realise they could exist & be confused.