D vs Java as a first programming language

bearophile bearophileHUGS at lycos.com
Sun Sep 28 05:20:33 PDT 2008


Nicolas Sicard:
> What feature would make D a worse choice than Java for a first language?

Choosing the "right" language to teach programming is difficult. Once Pascal (or Logo for young ones) was a safer bet (but even in the past Scheme was present and not bad). The first thing to ask is what's the age of your students.
If they are very young then D is unfit and Python/NetLogo/etc are probably better.

If they are college students then Java isn't that bad choice, because it has uniform syntax, very few special cases, works well, it's the most used language in the world, it has tons of libs, IDEs, you can find lot of books, lot of answers and docs on the net, the HotSpot today runs programs quite quickly, and so on. So it's a rigid, boring language that makes you write very long programs, but it has its advantages.

D is less safe, it doesn't have a really standard library yet, and compared to Java no one uses it, and no one uses it to work (compared to java still), and the compilers have lot of bugs still, so after your courses the things they know become less useful for them, and you they have more problems producing working programs.

To be truth, I think D is a nice language, but it's closer to the CPU than languages like Python and Java. This has both downsides and upsides. If your students don't know any other language, I think D is too much complex (it's a system language still).

Scheme is nice, but it makes you go mad a little.

New languages like Clojure, Scala, ecc too are nice, but too much unripe yet.

So beside asking the age of your students, a second important question to ask you is the kind of things you want to teach, and the kind of students you have. If your purpose is to teach just programming, then Java may be better. If your purpose is to teach some math too, to think in a flexible way, logical thinking, recursivity, functional programming, parallel thinking, and so on, then maybe Scheme is a better choice, despite it's almost useless compared to Java.

If your purpose is to teach lot of programming with the minimal problems, then probably a language like Python is better. When they know Python then they can learn C or Java or even some basics of Haskell...

If you answer those two questions I can give you a better answer.

Bye,
bearophile



More information about the Digitalmars-d mailing list