Georg Wrede:
>   - It has to be compiled to genuine executable code.

This is a very interesting topic, but I don't agree with some of your ideas.

I think that today there are no languages really fit as first language. Every 
language has downsides if you use for that purpose. And the sad thing is, if 
you design a language for teaching, it probably comes out as a toy language 
that no one wants to use anyway.

Said that, a teacher has to choose a language anyway. In my opinion the best 
languages for such purpose are Python, D1 and Java. Other alternatives are 
StarLogo (And its variants, like NetLogo), Processing, the Logo that can be 
used to control Lego, and few others.

As a first language the need to be compiled to "genuine executable code" is 
irrelevant, performance, assembly and binaries are not interesting for a person 
that has to learn tell apart while from do-while and an array from a set.

StarLogo is good because it teaches GUI and multiprocessing from the beginning, 
it helps develop some intuition regarding complex systems made of many simple 
small parts that interact, can be used and shared online, and it has a quite 
good visual feedback.

Java is good because it's a real language, with tons of libs. And its compiler 
is very strict (stricter than the D compiler) so it helps develop good 
programming habits, and it helps spot bugs quickly. Being statically typed and 
being dumb (no type inference, etc) it helps learn to manage types in a manual 
and correct way (but the student doesn't learn higher level concepts, like 
higher level functions, functional programming, etc etc). It's simple enough 
(but not very simple to use), a little fussy, and helps teach some OOP.

D1 gives more freedom, allows to learn pointers, linked lists, what a compiler 
spits out, it's a way to use assembly (inlining it), and you can learn almost 
as much OOP as with Java. It helps understand what the computer does when you 
write code, because there's a more direct relation between code and asm. It 
allows you to learn some C removing some of its disadvantages and in a safer 
way, removing some of the time wasted hunting for bugs in C code. If can even 
be used to learn a bit of functional programming (but not that much).

Python is easy to use, less fussy, easy to read, its syntax is natural and 
usually such syntax doesn't get in the way. It's easy to learn and remember. 
Its indentation is both natural enough, clean and teaches how to indent code 
properly. It's flexible, it's a real world language with tons of libs 
(including tons of libs that can be used to teach all kind of things), it's 
practically useful for simple or complex tasks, it has enough C-like syntax 
that can be later used to teach Java or other similar languages. It can even be 
used to teach a bit of functional programming. It's not very good in teaching a 
tidy understanding of types. Its shell is really good for a newbie.

To teach programming to students about 15-18 years old I think Python is 
currently the best first language, for first introduction to programming about 
6-18 months long. Later D1 language (once it's more diffused and it has libs 
and its compilers are debugged, etc) can be useful to teach assembly, 
compilation, types, pointers, manual memory management, unions, struct and 
precise memory layout, to develop some intuition of the relation between 
program code and resulting asm, some more advanced data structures, other 
design patterns, etc. Java is not a real alternative to D1 here, because it 
lacks several things, but D1 is not common and refined enough, so some people 
may want to use Java as second language.

Older students, about university ones, if they already know a language, may 
even start with Java as first language. But soon they need something different, 
like C or D or some functional/parallel language (like Haskell or something) to 
learn other paradigms.

Younger students, like 8-14 years old may find something like StarLogo (and 
similar ones) as better than Python as first language (but here it's also a 
matter of the characteristics of the single student. Probably there are 12 
years old students that can program in Python in a good way. Other students may 
need something simpler. Brains are different, so you can't teach everyone at 
the same speed and the same way!). After a year or two Python can be 
introduced. Another possibility is "Computer Science unplugged" 
(http://csunplugged.org ), that's positive because it allows for more social 
forms of "programming", and because it can teach more computer science ideas 
and less key punching. It's not an alternative of real coding, but for students 
about 5-11 years old it can be useful.

Bye,
bearophile

Reply via email to