D vs Java

Georg Wrede georg.wrede at nospam.org
Mon Mar 20 17:47:14 PST 2006


Walter Bright wrote:
> I'm no expert on Java programming, but I get this question a lot:
> "What compelling reason does D have that would entice a Java
> programmer to switch to D?"
> 
> I know several of you have come to D from Java, and are expert Java 
> programmers, so you folks' reasons would be very valuable.

(I may write another post in this thread later. Right now I'm thinking 
of Java vs D in *academic* surroundings.)

"Some" years ago, we had to substitute Java for Pascal as the First 
Language in my university. It was not like anyone had any solid 
criticism against Pascal (especially when we were teaching Borland 
Pascal, which is 1. the de facto standard, 2. pretty usable, both as GUI 
stuff and CL stuff). It was because the students were about to start a 
riot against "a passé language forced upon them, on account of the 
faculty being old moldheads". Who cares if Pascal was actually 
_invented_ to be the first language.

Now, as a teacher of IT, I always found it hard to stand at the front on 
the first day, and having to answer questions like:

"Ok, now it says 'public static void main... on the chalkboard. Would 
you, Sir, mind telling us what that means?'

How am I going to explain that to folks new to programming, on their 
first day?

----

Some reasons for skipping Java for an "unknown, obscure language that 
nobody has ever heard of":

  - this language you can use *even* after the semester, for your own 
stuff and needs

  - it makes standalone programs, so you can do something and copy that 
to your friends -- and they don't have to install all kinds of VMs or 
whatever

  - the main *concepts* in programming look the same in D, Java, C, and 
some other important languages. Therefore, even if you end up 
programming in any of those others, stuff *will* look familiar to you

  - compared to [most of the "competing" languages] D has a 
straightforward way of representing the majority of both traditional and 
the more modern concepts of programming -- thus letting the teacher 
_and_ the students concentrate on the issue at hand, as opposed to 
learning language specific quirks or idioms

  - the VM that Java resides upon, is just another burden for the 
teacher. Especially the smarter students have a hard time visualising or 
conceptualising what's really going on

  - programming concepts (taken as a whole) manifest themselves more 
clearly and more straightforward to the students, than e.g. in Java. 
(Note, here some might argue that C is superior, but nobody in their 
right mind would teach C as a First Language, and we haven't eve started 
to talk about C++)

  - if you take the gamut of Programming Abstraction Levels that Java 
spans and compare it to that of D, you'll find that D now spans the 
distance logarithmically from C to almost Lisp. (!!!) (( Where Java is 
half-way, and *stays* there.))

  - blinding compilation speed combined with aborting before 10 miles of 
error messages, does really make a difference to student comprehension, 
and motivation

  - copyable and runnable results of compilation, that you can give to 
your friends or antagonists in the class

  - while knowing several programming languages right from the first 
year is considered a forte, some teachers forget that *one* language 
that the students *feel* their own [like a mother tongue], is rather 
important if one is to entertain a life long understanding, 
comfortability and handiness with programming as such

  - in CS, a language has to be useful both in _to_the_metal_ classes as 
well as a vehicle for teaching the more abstract concepts. IMHO, D 
serves both of these needs excellently -- additionally, with no gap in 
between

  - some CS classes contain Assembler programming. I have yet to see 
anything that even comes close to the ease (for the teacher) with which 
you can let the students concentrate on the assignments at hand, without 
struggling with all kinds of [to that class irrelevant] obligatories and 
inconsistencies [with initial setup of the registers, return values, 
stack handling, etc.] Be it with Windows or Linux.

===

I've said before, that I consider D as an almost perfect First Language. 
This should *never* be taken as belittling D, or its capabilities!

(There's a law in several European countries that says Driving School 
cars have to have stick shift. But none of them require that the car is 
a WW2 Jeep with a non-synchronized gear box. Or separate pedals for left 
and right brakes. (I've driven a Real Farmer Tractor, it had separate 
brake pedals for left and right! You don't wanna try that at home when 
you're on reverse gear.)

Just as nobody in their right mind would push C++ as the first language 
for *anybody*.

===

(Walter,) anytime somebody doubts D as a superior Academic Language, 
have them talk with me.

Another thing, if we can get D popular in the academia, both research 
and teaching will gain a lot. And as an aside, 5 years after that, 
who'll ever want to do programming in any other language???



More information about the Digitalmars-d mailing list