We should educate software developers to write good code instead of promoting some programming languages to be more fool-proof.
Yup, because chasing fool-proof is a
fool's errand.
Let me switch to POSIX C for an example. The way to read unlimited-length lines in POSIX C from
input (a FILE pointer) is
size_t size = 0;
char *line = NULL;
ssize_t len;
while (1) {
len = getline(&line, &size, input);
if (len <= 0)
break;
/* The line is in 'line'. It is a dynamically allocated buffer,
with 'size' chars currently allocated for it.
It has 'len' chars in it, followed by a nul char '\n'. */
}
free(line);
line = NULL;
size = 0;
if (ferror(input) || !feof(input)) {
/* Error reading input stream! */
}
Getting C programmers use this dynamically allocated approach (with
getline()) allocating or reallocating the
line buffer (like
realloc()) whenever necessary, in my experience has been the first step towards sane dynamic memory use patterns.
The second step is to drop examples with
opendir()/
readdir()/
closedir() like the turd they are, and help them use
nftw(),
scandir(), and
glob() for example.
If they've been introduced to function pointers, one can whet their appetite by showing a practical example of how to do run-time plugins using e.g.
scandir() or
glob(),
dlopen(), and
dlsym().
Along the basic trail, you can show as tangential nuggets or goals almost (but not quite) in reach right now, in the form of powerful but simple implementations without the common pitfalls.
Getting back to Python, the learning curve, especially the "I must suck before I get nice results" part, is much gentler.
The question
"how do I do X" is no longer hard at all; it is getting the general understanding to the level that the real question,
"how do I do X so that Y", is even asked.
With "harder" languages, the learners understanding of the entire logic of programming grows as they learn their first programming language. But with fast and easy languages, you can get nice results by copying a thirty-line example off the web.
I can definitely see why so many are interested in developing a programming language that would be best suited to be the first programming language; so that its structures and properties themselves supported building a working intuitive model of what programming itself is.
Unfortunately, that means that that language would really be only useful to learn the cognitive basics of programming, and would have to then learn one or more "proper" languages to acquire a marketable skill. To me, that's a good tradeoff, because knowing more than one programming language seem to be almost a prerequisite of being any good at it at all (statistically speaking). Others hate the idea, and instead look for a Single Language to Rule Them All.