D, Java? To D or not to D?

Alexander Panek a.panek at brainsware.org
Fri Jan 5 04:08:27 PST 2007


TPJ wrote:
> I decided to start with a simple statement: with this post I don't intend to
> start any flamewar. I'm definitely not a Java zealot, OS zealot, I'm not a
> zealot at all. I'm just a programmer who seeks for future technologies today.
> I'm doing it because I find investing in future technologies today very
> profitable. Of course only in case of really good technologies...
> 

Always a good approach. :)

> I'm a freelancer programmer. I work under a GNU/Linux box and I'm interested
> in development of portable desktop apps (*nices, Windows, MacOSX, perhaps
> other OSes in the future) and games (the same OSes, plus mobile phones).
> 

Seems like you'll like GDC, then..

> A few years ago I switched from C/C++ to Python. The reason was simple: I was
> fed up with low-level development in C/C++, and I was impressed by high-level
> development in Python. All I did in C/C++ could be done in Python with one
> significant difference: code was written much, much faster.
> 
> Now, after several years of using Python, I decided to switch from Python to
> Java. The reason is simple. Sometimes Python is too slow for my needs. Of
> course, I can use C in those cases. But using C means using another language
> and development becomes more complicated. In fact, I started to use Pyrex as
> well... Three different tools, no documentation standard for all of them...
> The hell.
> 
> Why Java? Because of many reasons:
> 
> a) Java programs are run by JVM. IMO it's a big advantage: the only thing I
> have to do is to "compile" my app on my development box, and then I can ship
> it without any changes for any OS with JVM.
> 
> b) I can write everything in Java. No need to use other languages and various
> tools. It means easier development.
> 
> c) Static typing. No more dynamic typing hell known from Python. (Dynamic
> typing is great in small scripts, but it becomes error-prone in more complex
> projects. At least in my own case.)
> 
> d) Java programs run fast enough. Take a look at
> http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=all&lang=all
> D got 67.6, and Java got 44.0. From MPOV this difference is not important. The
> difference between Java (44.0) and Python (10.1) is much more significant.
> 67.6 / 44.0 = 1.54
> 44.0 / 10.1 = 4.36
> 67.6 / 10.1 = 6.69
> 
> e) Java is very popular. It makes Java programs easier to port. I intend to
> write desktop apps for *nices, Windows and MacOSX systems, as well as some
> games (2D only!!!) for those systems and mobile devices. In my opinion Java is
> a good choice.
> 
> f) I don't care about memory. I can run Eclipse on my old Celeron 800 MHz +
> 256 MB RAM machine, and it just works.
> 
> g) There are great IDEs for Java. I use Eclipse, but NetBeans is also said to
> be a good one.
> 
> 
> And now I have found D. What can I say about it?
> 
> Disadvantages:
> 
> 1) In order to run a program written in D I have to compile it on the target OS.
> 

Gregor Richards has found a way to compile D code to JVM compatible 
programs, that can be run in a JVM. So, if this is taken a bit further, 
maybe we can even say "D runs in a VM, too, if you want".

> 2) D might be perceived as an alternative to Java or C# (I don't count C/C++).
> But it is really the case? Java was born in 1995, today it's a very known
> language. C# was born in 1999, today it's popularity is still rising. And D?
> Mars was born in 1988, D in 1999. How many people have heard about D? In
> comparison, say, to C#? How many apps and libraries are written in Java, in
> C#, and in D?
> 

You can't compare Sun & Microsoft to a one man show (AFAIK) like 
Digitalmars. Those are other dimensions of marketing and promotion, really.

> 3) There is no D for mobile phones (AFAIK).
> 

There's a guy that tries to get D working on a Nokia 770, I hope he got 
it working. Apart from that, as D can theoretically be run in a JVM, .. 
you know the rest.

> Advantages:
> 
> 1) It's said to be faster than Java. But is it really an advantage? I find
> Java fast enough for my needs, so why should I bother myself with D?
> 

I don't know how the speed advantage over Java is, but there's 
definitely more room for optimization than with Java. I can't answer you 
the question why you should bother yourself with D. That's your 
decision, after all. ;)

> 2) From FAQ: Since D can call C functions, any GUI library with a C interface
> is accessible from D.
> Does it mean that I can access *any* C library from D? If so, it a great feature!
> 

Yes, any C library. Apart from that, there's a tool to bind C++ 
libraries, too. (BCDgen on dsource)

> 
> So I ask myself a question today: should I invest in learning D? Is it worth
> my efforts?
> 

Definitely.

> To be honest, I still think that C# has better future than D.
> 

That may be, but that doesn't mean D isn't worth working with - actually 
it's the other way round.

> Why I ask all those questions, you may ask. Well - the truth is that:
> 1) I know Java.
> 2) I don't know C#.
> 3) I don't know D.
> 4) I might be wrong.
> 
> Therefore I post this message here. I'd like to know what you (the people who
> know D) say about it.

Very honest and nice post, still. :)

Hope that helps, best regards,
Alex



More information about the Digitalmars-d mailing list