D in the ix magazine about "programming today"

retard re at tard.com.invalid
Mon Dec 28 03:53:28 PST 2009


Sun, 27 Dec 2009 03:47:23 -0500, bearophile wrote:

> 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!).

Quite many young Haskell experts started with Haskell when they were 9-12 
years old. Having english as your native language and academically 
educated parents has a tremendous effect on e.g. vocabularity at that 
age. Some slumdog might only know ~3000 words at that age, child of a 
highly educated family perhaps 25.000 words.

I'm not saying that everyone should learn Haskell, but I know it's 
possible to learn stuff like Curry-Howard isomorphism, hylomorphisms, 
monads, monad transformers, comonads, and analysing amortized costs of 
algorithms at that age. It's just dumb to assume that young people can't 
learn something as complex as static types!

I remember when I was that young, I used to play with QBasic. I knew very 
well why 'DEFINT A-Z' made all programs faster and knew what IEEE 
floating point looked like on bit level (well, at least mostly). I knew 
how to do blits in graphics programming since I already had done them in 
assembly on C-64. Had there been Haskell and all the modern tools 
available like today there is, I would have probably spent more time on 
them.


More information about the Digitalmars-d-announce mailing list