6 ms·
Novice Programming Mistakes (2016)
- bgorman 5y agoIt is amazing how none of these bugs can happen with a compiling program in Ocaml
- blacktriangle 5y agoThe paper was explicitly studying Java. I suspect performing the same exercise against OCaml or any other language would give you a very different list of very real problems.
- tsumnia 5y agoI can't recall the exact author/paper, but I recall reading similar types of errors were observed by students learning Python. Edit: Found it (https://dl.acm.org/doi/pdf/10.1145/3287324.3287381 https://dl.acm.org/doi/pdf/10.1145/3287324.3287381)
- meetups323 5y agoOCaml doesn't have linear types.
- spdegabrielle 5y agoI think this is worth considering!
- Ashanmaril 5y agoI'm surprised mismatching parenthesis was a common mistake in 2016 given the ubiquity of IDEs and text editors that should catch a syntax error like that. == vs .equals() is pretty understandable considering that it's Java specific, and would be valid in most(?) other languages
- chapium 5y agoThere is also Objects.equals if you don’t want the ambiguity of “==“. The main reason I find myself second guessing this one is if you get used to the convention of other languages and then switch over to java.
- PennRobotics 5y agoWhile == vs .equals() is a Java-specific issue, other languages suffer similar (and often more hidden) equality problems. In C, you can have value equality or pointer equality. Then, you have the whole "either write your own character-by-character comparison or learn which libraries to include to compare strings". There's also the detail of remembering what strcmp() returns. I might be wrong since Python is not my daily driver, but "a is b" and "a in b" and "a == b" and "a == b and type(a) == type(b)" are all distinct from one another. Javascript has strict equality and equality.
- marcosdumay 5y agoThe reason people confuse "==" and ".equals" in Java is because they are confusing. In general, Java doesn't use the concept of pointers, and yet, one of its main operators does. That language feature is simply broken, and this is really not the same situation of confusing "a == b" with "a in b" or "type(a) == type(b)". One can say that comparison with None is Python is broken too, but the situation is much better because you get an error if you make a mistake, instead of your program misbehaving. Javascript, by the way, is way worse than Java here. In general the language does not differentiate a number from a string with a numeric value (something I imagine it copied from Perl), yet a lot of features do.
- renox 5y agoIn my experience IDE sucks for paranthensis/quote their autocompletion is awful because it only works well when you write new code not when you edit existing code.. And in VScode it isn't even possible to truly disable it!
- dave84 5y agoAll of the code was written in BlueJ in 2013-2014, I have no idea if the versions of BlueJ in use at the time had the parenthesis matching feature.
- ryanianian 5y agoIt'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.
- nicetryguy 5y ago> .equals() That's an atrocity.
- AnimalMuppet 5y agoTo me, the more interesting thing about this article is that professors are only moderately correct about what mistakes their students typically make. This despite the fact that we might expect professors to be experts on what their students have a hard time understanding, and what mistakes often flow out of those misunderstandings.
- dave84 5y agoThe paper does not say that professors are only moderately correct about what mistakes their students typically make, just that their personal experience does not align with the results of the cohort used in the study. A professor may be perfectly correct at a local level but globally only moderately correct. The contextual knowledge of the professor is not acknowledged in this study (curriculum, course level, teaching style, problem set, student background, lecture notes, textbook choice, compiler, IDE) nor are the professors own students who may only come to the professor or TA with a certain subset of problems etc.
- AnimalMuppet 5y agoFair point.
- spdegabrielle 5y ago“So, what's the most common kind of error novice Java programmers make? […] mis-matched or unbalanced parentheses.”
- Minor49er 5y agoOne big mistake that I would frequently run into as a novice is not using source control, or at least saving versions of my work. I would start making a complicated change, end up breaking some fundamental part of the program, and wouldn't have any way of going back to a version that worked since I would always just save in the same file. Things like version control might seem like a chore to someone who has not had their time adequately burned by their own mistakes.
- WalterBright 5y ago> Things like version control might seem like a chore to someone who has not had their time adequately burned by their own mistakes. Haha, that is true of advice in general. People generally do not accept advice until they have enough experience to recognize that the advice would have saved them a lot of grief: Year 0 - what's a buffer overflow? Year 1 - I'm too smart to be one of those noobs who have buffer overflows. I don't need X that prevents them Year 5 - wow, that's a great idea for preventing buffer overflows! I wish I knew about X years ago
- tsumnia 5y agoI think its a two-fold issue: 1) Version control adds ANOTHER concept to students that can be difficult to grasp/appreciate. Adding it in is great from a practicality standpoint but increases the cognitive load of students with ANOTHER new technology. 2) Sometimes, the code just hits a point where its no longer salvageable. It sucks to tell a student they should start over, but often times wiping the slate clean after making a mess can help consolidate their thought process.
- black_13 5y agoMy novice mistake is not looking around and noticing the lack of ppl older than myself.
- cjfd 5y agoI think the most important mistake is writing needlessly complicated algorithms. I.e., creating more auxiliary variables than needed. Also 'if (condition == true)' tends to happen quite a lot.
- matoyce 5y agoWhen I started programming, the first mistake that I have encountered is that I did ignore the spacing rules in Python, thus creating errors even though the code was correct.