6 ms·
> Nobody fails CS101 because they can't remember the syntax of function definition, they fail because they can't figure out which functions they need to write t
by jonawesomegreen 9y ago
> Nobody fails CS101 because they can't remember the syntax of function definition, they fail because they can't figure out which functions they need to write to make a ball dance across the screen.
In my experience that isn't that case. I TAed CS101 while I was in grad school and there were a lot of folks that had a really hard time with the concept that a missing semicolon or comma would make the program not work. I heard: "why doesn't it just know what I mean" more then I would have thought possible.
I think learning the strictness and structure of programming is actually harder then you think when people have never done it before.
- stephengillie 9y agoWhy do we embrace the strictness and structure of these languages? Why aren't a line break and a semicolon equivalent? Learning may be easiest in a scripting language like Powershell, where all libraries are loaded by default and semicolons don't matter. Errors like missing commas are often pointed out explicitly in the error message. The JIT nature of the console allows for very agile learning. For any given operation, there are usually at least 2 ways to do something. Variable types are optional and very flexible. Finally, the help system can auto-build a rudimentary help page for any function, even custom functions you've written with no help section, giving a basic idea of inputs and operation.
- userbinator 9y agoWhy do we embrace the strictness and structure of these languages? Why aren't a line break and a semicolon equivalent? Because, to put it bluntly, that's just how the machine works. The language uses semicolons to delimit statements so that you can break long statements across multiple lines, or have multiple statements in one line. They are very similar in function to full stops and semicolons in English (which is coincidentally another language where newlines and semicolons are not equivalent.) "But why can't it just figure it out?", you ask. Look at the "automatic semicolon insertion" rules in JS for an example of how trying to "make it easier" only leads to more complexity and confusion. The "strictness and structure" is inherent in the way computers function, and I think getting used to and even embracing it earlier rather than later is very important for being a successful programmer. From personal experience, Powershell syntax is quite frankly ridiculous even for an experienced programmer, nevermind all the "behind your back" things it does that leads to subtle and very confusing bugs (especially around character encoding)...
- stephengillie 9y agoBoth Powershell and Javascript are "curly-bracket" type languages. Yet semicolons are only mandatory in one. Why? (Powershell can have nightmarish encoding problems. "Why did my file change from UTF-8 to "UTF-16LE BOM"? Is that why Powershell can't read the file?")
- userbinator 9y agoPS is meant for interactive use, which is why using the newline to terminate statements makes sense (and then they had to introduce another separator for multiple statements on a line, along with a way to break up a statement across multiple lines.) JS is not. The amount of PS "semicolon vs newline" discussions and articles (as well as those about JS's ASI) shows the downside of this additional complexity and the confusion it causes --- contrast this with C or C-derived languages like Java, where the only statement terminator is the semicolon (and block statements end with }.) In general, you can see languages designed with interactive use as a primary goal (bash, cmd, PS, Python, ...) tend to also use a newline as a statement terminator.
- spion 9y agoBecause the rules for parsing it would be more complex. That would be an exercise for the student: How would you describe the rules? Then the teacher would show them all these edge cases they haven't considered, taken from real programs so that they don't complain its a contrived example.
- stephengillie 9y ago> Because the rules for parsing it would be more complex. The rules for parsing this are already so complex that many humans don't grok them; only computers do.
- mannykannot 9y agoThis is very interesting. Assuming these students are reasonably capable at problem-solving in general, what would account for this helplessness with regard to programming specifically? Off the top of my head, I can guess at a couple of reasons: 1) Programming languages are superficially like natural language, so the students unconsciously assume they are working with an intelligent agent (and if it is taken to be intelligent, then it seems to be a deliberately difficult one.) 2) Error messages often point to the code following the actual error, which again seems to be deliberately deceptive.
- threatofrain 9y agoWere those students learning with a homogeneous environment with IDE / modern editor features?