3 ms·
> but a beginner-friendly, useful language where the problem simply doesn't exist - namely Python. Python? I would rather tech my child Lisp or C , white space
by simion314 5y ago
> but a beginner-friendly, useful language where the problem simply doesn't exist - namely Python.
Python? I would rather tech my child Lisp or C , white space being important is very confusing.
For first time programming I would make a simple language that uses syntax like:
if end_if for end_for function end_function
then it would make more sense then tons {} or stupid tabs and spaces.
- jvvw 5y agoI've helped a lot of children learn Python (volunteering) and the whitespace hasn't actually been a huge issue. They seem to get the hang of it quickly. The typing, dealing with syntax errors which don't explain clearly the problem, and motivation are the main barriers I would day. It is quite nice for them to learn a language that is used in anger professionally. The first experience of most children here (in the UK) at school and elsewhere with programming is Scratch, a visual block-based programming language. So no typing or syntax errors, and very quickly you can makes games etc. It's got its pros and cons.
- franga2000 5y agoIn my experience, Python's whitespace-based blocks usually "click" with students faster than {} or start-end blocks. Especially if they previously learned visual programming like AppInventor/Scratch, having subsections indented to the right will be more natural than end statements. More generally, no program will be easily readable to a human without indentation. Having to scan aheas to find the endif, then find back where I was, then keep a mental note of the "block" of code that I'm looking at is really annoying, while indented blocks make that separation visually obvious. So if we already have to use indentation for our own sanity, why do we make ourselves add clutter like end statements for the compiler's benefit, when in reality, it has absolutely no problem understanding our indentation directly?
- simion314 5y agoI think it would make the code easy to read for a beginner. It could also make the error reports much more clear, instead of "Unexpected symbol }" you can print something like "This for is missing it's matching end_for". I don't like identation, it is easy to mess it around if you copy and paste code, or if you make edits, is like we would background color the blocks of code, it might look more visual but will cause issue when we actually manipulate the text. It is a shame that at the beginning of learning to program you are hit with this many concepts and on top of that with this complex programming languages , why we did not invent a simple , more limited but perfect for teaching one? I assume some will say why should we waste time teaching a toy language when we can teach the real thing.
- franga2000 5y agoThere can't be such a thing as a perfect teaching language because there are many aspects to learning programming and the way you'd make those things easy aren't always compatible. "Typed" or not? Automatic or manual memory management? Pointers? ... But when it comes to teaching the core idea of encoding an algorithm with lines of text, the main thing seems to be that the less syntax there is to think about, the better. Parentheses, brackets, semicolons, variable declarations, etc. are all in the way. We have two very good languages for this - Python and Lua. I much prefer Python for many reasons, some of which I explained earlier, but Lua also works very well. The copy-paste issue is real though, I'll give you that. Modern editors (e.g. PyCharm) completely solve it, but when using less sophisticated tools, it is a pain. Still, I can't imagine teaching programming without indentation being an important part of it and Python conveniently forces you into it. Perhaps Lua with format-on-save would be better in this regard I might try that some day...
- simion314 5y agoI disagree, but let me know if you have experience teaching someone python, Python is replacing say both "{" and "}" with one character a space. When I teach my son I always tell him "when you open the ( or { always add it's matching closed one (if teh editor does not do it and only after you closed it you add your stuff in. So for a for I teach him to start with for(){} then fill in the stuff. It makes sense to be more explicit. We did not have issues with types though, it makes sense that int and float are different things and you need to be clear about it.
- franga2000 5y agoI have taught a handful of programming intro classes in Python, JavaScript and Java (to mainly high school students). Java was by far the worst, since it has a lot of boilerplate that beginners just need to memorize, which is very discouraging. Starting off with types also made the lessons less focused, but I should've adjusted the pre-programming lessons to fix that. JavaScript was great for the first few programs where the automatic type casting let us have quick and satisfying results, but then the messiness of the stdlib made anything that wasn't self-contained (reading/writing files, drawing...) a pain. In both of these cases, students' code was utterly unreadable and issues were hard to find, despite in one case saying indentation was actually required (was that immoral?). I try to guide students to follow their drawn flowcharts along with the code to see where it goes wrong, but a lot of the time, their code was all over the place, which made that difficult. With Python, that last issue was basically gone, since the layout of the code is the thing that instructs the interpreter. Getting the syntax correct wasn't an issue in either of the languages, but this time, correct syntax necessarily also meant nice layout. The students' code was much more similar and that made it easier to guide a large group through analyzing their code to find problems. The way I transition students from flowcharts to code is through an intermediate "step list" notation that they're already used to from procedures they learn in chemistry and other lab classes, as well as generally in instruction manuals. That notation often uses nested (indented) sub-lists, which are almost directly copyable to Python. If I didn't have that step, perhaps the benefit of Python code layout wouldn't be as pronounced, but I think this way of teaching is generally beneficial, even when not targeting Python. Some notes from the Python classes: the editor should be configured to turn tabs into spaces - no tab character should ever reach the file, even if copy-pasted (I'm 100% on team tabs, but they're horrible for beginners in Python). Skip "idiomatic" things that seemingly simplify code (open file contexts, "or default" expressions, ternaries...) and instead use longer versions - the less knowledge required the better, despite the resulting code being more "complex". Use f-strings and ignore string concatenation for as long as you can. The turtle library is your friend.