165

Is the D language a credible alternative to Java and C++? What will it take to become a credible alternative? Should I bother learning it? Does it deserve evangelizing?

The main reason I ask is that with the new C++ standard (c++0x) almost here, it's clear to me that the language has gone well past the point of no return with respect to anyone ever understanding it. I know that C/C++ will never die but at some point we need to move on. Even COBOL had its day and Java has in many respects undone C++. So what's next? Does D fill the bill?

nbro
  • 15,395
  • 32
  • 113
  • 196
Mark Kegel
  • 4,476
  • 3
  • 21
  • 21
  • 23
    COBOL is coming back, but go ahead and learn D if it tickles your fancy. Reading tea leaves has as much of a shot as anything else at predicting The Next Big Language. – Shog9 Sep 28 '08 at 22:14
  • 5
    I'm not concerned with what the next big language is, I'm concerned more that if I were to tell my more employer that I wanted to use D on my next project that I wouldn't be taken seriously because the language isn't yet. – Mark Kegel Sep 29 '08 at 11:17
  • 1
    See also http://stackoverflow.com/questions/56315/d-programming-language-in-the-real-world. – Michael Myers Sep 30 '08 at 13:42
  • 23
    should be noted that the "D vs. C++" pages by digital mars are highly discriminating against C++. many times they say "c++ can't do it", C++ *can* do it – Johannes Schaub - litb Dec 27 '08 at 06:47
  • 24
    @Johannes: It’s not about what the language makes possible, it’s what the language makes easy. - Brian Hurt – missingfaktor Mar 26 '10 at 09:29
  • 9
    @Rahul, agreed but then they should say so. like "this isn't easy to do in C++" and not that it's not possible at all. – Johannes Schaub - litb Mar 26 '10 at 11:54
  • @Johannes: Well, in that case, I agree. – missingfaktor Mar 26 '10 at 13:08
  • 2
    have you looked at the TIOBE index http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html – dbones Oct 01 '10 at 23:25
  • 1
    Wwhat ever all say or what ever all think, its a great language to offer us with mix of all languages: ex: http://d-programming-language.org/phobos/phobos.html –  Apr 04 '11 at 22:01
  • 1
    As someone who is currently in the process of switching from C++ to D, I must say that the whole language feels cleaner. Over the years, C++ has become a patchwork of haphazard additions that still try to maintain backwards-compatibility. D, on the other hand, was designed from the ground up. – Maxpm Apr 05 '11 at 01:03
  • The only way to answer the question "Is language X fit for my needs?" is to write a non-trivial project in language X and see for yourself. – fredoverflow Oct 16 '12 at 06:32
  • 3
    D as it stands now is by no means a "system programming language", with all its reliance on GC and all. How can one possibly write an OS with that? – rustyx May 21 '16 at 14:34

13 Answers13

128

What determines the success and popularity of a programming language for real-world software development is only partially related to the quality of the language itself. As a pure language, D arguably has many advantages over C++ and Java. At the very least it is a credible alternative as a pure language, all other things being equal.

However, other things matter for software development - almost more than the language itself: portability (how many platforms does it run on), debugger support, IDE support, standard library quality, dynamic library support, bindings for common APIs, documentation, the developer community, momentum, and commercial support, just to name a few. In every one of those regards, D is hopelessly behind Java, C++, and C#. In fact, I'd argue it's even behind so-called "scripting" languages like Python, Perl, PHP, Ruby, and even JavaScript in these regards.

To be blunt, you simply can't build a large-scale, cross-platform application using D. With an immature standard library, no support in any modern IDEs (there are plugins for both Visual Studio and Xamarin Studio/MonoDevelop), limited dynamic/shared library support, and few bindings to other languages, D is simply not an option today.

If you like what you see of D, by all means, learn it - it shouldn't take long if you already know Java and C++. I don't think evangelism would be helpful - at this point if D is going to succeed, what it really needs is more people quietly using it and addressing its major shortcomings like standard library and IDE support.

Finally, as for C++, while most agree the language is too complex, thousands of companies are successfully using C++ as part of a healthy mix of languages by allowing only a smaller, well-defined subset of the language. It's still hard to beat C++ when both raw performance and small memory usage are required.

LMS
  • 4,117
  • 5
  • 27
  • 37
dmazzoni
  • 12,866
  • 4
  • 38
  • 34
  • 3
    You can build large-scale cross-platform applications, the issue is more with how specialized it needs to be (and how esoteric your platform is). – larsivi Sep 30 '08 at 12:21
  • larsivi is correct, if you don't think you can write large-scale cross-platform applications, you are sadly mistaken. – Rayne Oct 30 '08 at 19:43
  • 8
    saying it has "no support in any modern IDEs" is overstating it a bit. There is support in eclipse. It isn't 1st class yet, but it is there and getting better. – BCS Nov 04 '08 at 18:50
  • 3
    So which large-scall cross-platform applications have been written in D? Give us examples instead of just saying dominic's answer is wrong. – jalf Mar 08 '09 at 09:06
  • 48
    Absence of evidence is not evidence of absence. – FeepingCreature Aug 08 '09 at 14:54
  • 31
    If one makes a positive assertion such as 'there are pink unicorns', one must offer evidence before it is reasonable to accept. Granted, that doesn't mean there are no pink unicorns as @FeepingCreature stated, but simply stating that is not a compelling or valid argument. – JoshD Oct 01 '10 at 23:28
  • There is support now in modern IDEs ... Eclipse on the *nix side and VisualD for Visual Studio guys... – bbqchickenrobot Feb 18 '11 at 18:29
  • 8
    @Feeping: That's a cute saying James Randi likes to throw around, but it simply isn't true. It your tests have reasonable evidence supporting that the test *should* find something, but don't, that's evidence of absence. – GManNickG Feb 25 '11 at 20:01
  • D language does not have tools but it has the flavor of C/C++ and Lua/Java tricks. Which i believe will be really the new version of C++ and C#, the look and feel of coding is almost same like C/C++ easy to bind with native C and C++, also possible to do 8,16,32,64 bit processor surfing. Easy to write code, what else we want from a language. see: http://stackoverflow.com/questions/5524161/d-language-i-should-move-forward-if-i-would-like-to-minimize-using-c-c-java –  Apr 03 '11 at 13:44
  • 9
    I want to add that we DO build large scale applications with D1 and Tango. Okay, we are not cross-platform but linux only, but still. Our whole infrastructure is written in D and we process more than 30k requests per hour with a large DHT back-end also written in D. – Marenz May 26 '11 at 10:11
  • 2
    @dmazzoni, For those who believe technical superiority should always win ask; Do they use a QWERTY keyboard and why? – Peter Lawrey Jun 10 '11 at 14:10
  • Marenz fun to find you here, actually gotta necro here to add that this very backend breaks on all edges. I won't blame the language for it, but it really isn't on time 2019 anymore. Its certainly an interesting language, but really not a good one. Every single part of the system you spent 6 years on, couldve been built in java using libraries withing a few months – kleopi Aug 21 '19 at 15:06
  • @JoshD Replace "unicorns" with "extraterrestrial life" for a more illustrative example. – user76284 Feb 05 '21 at 00:51
109

Just to add my own experiences into the mix:

About a year ago I worked on a small scale game project (3 coders) lasting 3 months, where we used D as our primary language. We chose it partly as an experiment, partly because it already had bindings for SDL and some other tools we were using, and mostly for the benefits is appeared to have over C++.

We loved using it. It was quick to learn and easy to write. Many of it's features proved invaluable, and I miss them having gone back to C++.

However, the following points made our lives more difficult:

  1. There was no good IDE at the time which was a major issue. We ended up making our own by customising Scite. This worked ok, but was not ideal.
  2. There was no debugger at the time. We managed to get WINDBG to work on a hit-or-miss basis, but it was unreliable. Debugging code without a debugger made life hellish at times.
  3. There were 2 standard libraries to choose from at the time (Tango and Phobos). We started with one, switched to the other, and really needed a mixture of features from both (Tangobos!). This caused headaches and some code re-write.
  4. Bindings to other tools not available. In the end we had to switch to DirectX (for reasons I won't get into). There were no bindings for DirectX available so we had to write our own in C++, build it as a .dll and bind to that. This was fairly nasty work and took some time.

Overall, we loved to write D. It made actually writing code easy and was quick to learn. The issues I've mentioned echo the answer that has been accepted for this question - it's the "extra" bits that need addressing in D, the core of it is solid.

Ajay
  • 18,086
  • 12
  • 59
  • 105
xan
  • 7,440
  • 8
  • 43
  • 65
  • 6
    cool input... now there is a debugger!! :) – bbqchickenrobot Feb 18 '11 at 18:31
  • 15
    I don't understand why DirectX is a problem. I'm not a D programmer, but I thought D can understand C? And DirectX has a C API? –  Jul 30 '11 at 14:47
  • it is relativly easy to use the DirectX stuff with native D interfaces, so writing a wrapper in c++ is not needed except for some special cases – Quonux Apr 26 '13 at 12:41
  • @Quonux: That was our experience at the time, back in 08. Have no doubt things have moved on a lot since then. I can't recall the gory details any more. – xan Apr 10 '15 at 11:04
  • 3
    2019 update: The D Programming Language has expanded significantly. You can now use GDB out-of-the-box with Dlang. DPP let's you directly include any C header in Dlang. Calypso let's you use any C++ library in Dlang, including Qt-- it has a few bugs, but it largely works. – noɥʇʎԀʎzɐɹƆ Sep 05 '19 at 23:00
61

I agree that C++ is becoming a dead-end language - and it pains me to say that, after having used it for the last 17 years.

I think D is the rightful successor to C++. From a language perspective it "does all the right things" (even if I don't agree with every minute decision). I think with C and C++ on the decline there is no other systems level language that can really do what they do, while holding itself up in the world of modern languages - except D! Not only does D fill this role - it excels at it! A look at D1.x should be enough to convince you of that - but when you look at D2.0 it blows you away. It is my opinion that there is no other language around today that works as well as D2.0 in bridging the imperative and functional programming paradigms - which is only going to get more significant in coming years.

Lack of mainstream acceptance - or even visibility - as well as large scale, mature, libraries - are an obstacle of course. However I don't think you can write it off because of this. I am convinced that D will grow to become one of the most important languages around within the next few years - and those that are taking it seriously now are going to be well placed to take the lead when that time comes.

I think the difference is going to come about due, in large part, to Andrei Alexandrescu's involvement. That's not to discredit Walter Bright in any way, who has done a momentous job in bring D to the world. But Alexandrescu is an important, and compelling, figure in certainly the C++ community - and there's where most of the potential D switchers are going to come from. And he has also made a significant and important contribution to D2.0 in its support for functional programming.

It may still turn out that D is doomed to be the Betamax of systems level languages - but my money is on it turning around within the next two years.

kfmfe04
  • 14,936
  • 14
  • 74
  • 140
philsquared
  • 22,403
  • 12
  • 69
  • 98
  • 20
    C is not on the decline for systems level programming. Linux, Windows, and OS X are all developed in C. Likewise, many micro-controllers and OSes for micro-controllers are programmed using C. – Kevin Dec 27 '08 at 06:46
  • 3
    I agree with Kevin. In those areas C is just as strong as it always has been. – Bob Somers Mar 08 '09 at 01:08
  • 12
    I don't think D "does all the right things". The right thing would be to start over from scratch, not try to make a better C++. I think more radical changes are needed to justify a large-scale switch away from C++. – jalf Mar 08 '09 at 09:10
  • 9
    Kevin: Windows and OS X are not developed in C. Chunks of the kernel are, of course, but Windows uses heaps of C++, and OS X Obj-C. Linux is the only OS I know of where C has been elevated to One True Language-status and nothing else is used. – jalf Mar 08 '09 at 09:11
  • 2
    C is not on the decline, and it's hard to see how you can justify that claim. C++ might be, however – JamieH May 14 '09 at 00:54
  • Well, I think C had it's decline a long time ago. It's made somewhat of a comeback (largely thanks to Linux, and a bunch of disillusioned C++ developers). C++ certainly is, as you say (although it has made a mini-comeback in the last couple of years too) – philsquared May 14 '09 at 10:09
  • What constitutes "a look at D1.x"? I looked at pretty much all the freely available information and wasn't impressed. Not impressed enough to actually try it or to buy a book about D. I don't want to look at code examples or at feature laundry lists. I want concepts, explanations, etc. – sellibitze Jun 04 '10 at 19:28
  • 17
    Nice Prediction. It's been 2 years since this post, and D is not any closer to mainstream adoption. – mikerobi Nov 17 '10 at 14:29
  • 18
    @mikeobi LOL! The two years starts from whenever you read that sentence ;-) – philsquared Nov 24 '10 at 07:32
  • 2
    This is a very nice comment i wanted to ever read about D language. I think the more expert level and years of experience you have, the more you will like D, because it has all practical tricks on it, thats they beauty of this language. –  Apr 03 '11 at 13:59
  • 4
    Here we are almost four years since this post and it doesn't look like the situation had changed. Now I wonder how Java and C# were able to become so successful ... I guess being backed by a major player like Sun or Microsoft makes the difference ... – ahans Jun 13 '12 at 07:29
  • 1
    @ahans: A look at Objective-C's comeback proves that "theory"... – MFH Sep 02 '12 at 17:07
  • 4
    Ha! Just happened to look back at this. Yes, it pains me to say it, but it looks like D has missed it's chance. I was wrong in my prediction (at the time I wrote my original reply I was also buying shares in Barclays Capital!). Personally I'm betting more on F# now, although that doesn't fulfill the systems language role. If you need a systems language then C & C++ continue to be solid options (with C++11 being a very nice refresh of the language). There are also other languages like Go now which are gaining some traction - but not sure if they'll get as far as they should. – philsquared Mar 24 '13 at 12:39
  • One more year, and an article in wired http://www.wired.com/2014/07/d-programming-language/ – julienfr112 Jul 08 '14 at 01:23
  • 1
    I don't think C++ is dead or will die soon for the same reason it does C: people use it and there is too much available. And C++ is almost compatible with C. Why should we switch to a newer lang with features when it has limited compatibility with the tools today and C++ keeps receiving many of those features? I don't mean D is not nice. It is, and a lot, it is just not an option, and it will be very difficult for it to ever catch C++, because C++ keeps adding useful features. – Germán Diago Dec 11 '14 at 11:33
  • 4
    Another year later, I think it's safe to say that the premise has been disproved. That is, C++ has cleverly maneuvered out of the dead-end, and has been going places, good places, for the past 5 years or so at least. While it is encumbered with backwards compatibility, context-sensitive syntax etc. - it's improving on almost all fronts. So the rightful successor to C++ will be newer-style C++. – einpoklum Jan 16 '16 at 10:35
  • 2
    @philsquared 2016 is halfway and there is nothing about this "D Language" anywhere while C++, C, C#, Java, are still thriving. D is a dead programming language if not already then will be. – Simple Fellow May 20 '16 at 07:50
  • So, another year has passed and D is still nowhere to be seen... – MFH Feb 06 '17 at 23:11
  • Ha! I think we all agreed that D missed the boat some years back (see my earlier comment in this thread). But D is still evolving and getting more viable. Maybe it still has a chance. Last I heard they were working on full C++ compatibility - that could be a big deal. Meanwhile I'm working with "modern" C++ and Swift. – philsquared Feb 07 '17 at 09:33
  • Some more "2 years" has passed and D has been at least included in GCC! Feels nostalgic to see your post in 2023 for the first time. Anyways, I remember D was a good language in 2003 or so, when I first saw it on the net. I wish they add its good features into new C/C++ standards and call it Super C++. ^^ – Vic Apr 21 '23 at 19:31
21

I like that D is the work of a genius, primarily one mind - Walter Bright, whose Zortech compiler was fantastic in its day.

In contrast C++ is too much design by committee, even if Bjarne is an influence. Too many add-on features and weird new syntax. This difference reflects in the ease of learning and ease of everyday use, fewer bugs.

The more coherent languages lead to better productivity and programmer joy - but this is subjective and arguable! (i guess i should vote my own answer down)

Ferruccio
  • 98,941
  • 38
  • 226
  • 299
DarenW
  • 16,549
  • 7
  • 63
  • 102
  • 10
    There's another genius working on it now too - Andrei Alexandrescu. What he has done with D2.0 is, IMHO, at least as astonishing as what Walter has done with D1.x. Between the two of them (not discounting the numerous other contributors) D is becoming a language to be reckoned with. Watch this space – philsquared Oct 30 '08 at 15:20
  • 6
    make that 3 (or more) darn good programmers: Bartosz Milewski – BCS Nov 04 '08 at 18:52
  • 7
    So C++ was originally created by one really smart guy, and is now controlled by a committee of really smart people, whereas D was originally created by one really smart guy, and is now being controlled by a... group of really smart people. Yeah, I see how that makes D superior. ;) (hint: the uglyness of C++ is nothing to do with committees. It is a consequence of the language's design goals. It was intended to be (nearly) a subset of C. D is not, and was not intended to be so, which means that it could avoid a lot of the warts (at the cost of also avoiding the popularity it brought) – jalf Mar 01 '13 at 13:34
  • 4
    @jalf you're right that C++'s "ugliness" is not due to being designed by committee. It's slowness in evolution is, though. – philsquared Mar 24 '13 at 12:44
  • @jalf a superset – QuentinUK Aug 02 '22 at 13:04
15

D is a good language and decently popular, but like all languages, it is just another tool. Which tool to use depends on the kind of person you are, how you think, the environment you are working in, what restrictions of the languages apply the the program, and most importantly, the program itself. If you have the time, I would definitely recommend learning D. Worst case scenario, you will never use it. More likely you will learn what aspects of it you like the most, and under what conditions it shines brightest, and take advantage of that for when making new programs.

I would recommend looking at the D comparison chart to see what the features are for the language and see if it sounds right for you.

Spodi
  • 1,151
  • 1
  • 11
  • 19
10

D language is modern. No language is perfect, and there is no doubt about this. But languages are born to make life easier. Where D language compared to C++ has lot of good features, in terms of complexity. Many other language combination specialty is involved, which helps coders to code faster, with TOP features introduced by other languages. Please see also: for more details about D and other languages

  • D vs C++, is the compatibility, where huge C++ languages are involved and requires compatibility with D. D allow already 100% compatibility with C, which is a good win still.

  • D vs C++, C++ is my opinion very nice language, but its hard to code, and time consuming, requires more and more experience to get success, but D allow to do the same with simplicity

  • D vs C++, i am not sure if C++ does, but D do allow none type restriction variable assignment using "auto", which is good to have a variable dynamic, when require you can make a strict type

  • D vs C++, if you have other language experience, you can straight get started with it, it has easy learning road map, and its getting designed by a strong experienced team and company support

  • D vs C++, the very nice thing i found of D, is the code style, it gives the look and feel exactly the same like C/C++, while coding it reminds i am doing really modern C/C++ which called D

There are lot of more good reason for D language, there is no reason to underestimate any language, its always the user choice.

Community
  • 1
  • 1
7

It really depends on what your needs are - large scale commercial applications written in D do exist on the server side, and for that D (typically using Tango/Mango) is a perfect fit, and you are likely to be able to serve more requests than with any other language/platform.

For more specialized solutions in terms of protocols and interactivity (which many are) you will have more problems finding the needed libraries, and the lack of tools is likely to affect you more.

mcandre
  • 22,868
  • 20
  • 88
  • 147
larsivi
  • 1,485
  • 10
  • 16
  • 1
    could you provide an example of such a commercial app ? – Alexander Malakhov Aug 18 '10 at 05:35
  • 1
    @ Alexander Malakhov: A...hmm... good question.... I'm happy you asked if a commercial app exists.... well thought question...certainly..... I admire......this is the kind of questions we should ask..... shows your intellect.....hmm... let me search ...Commercial app in D...hmm....well ...just wait... I know but.... just can't recall it... there certainly are.... just hold on ... I'm still searching... hang on! – Simple Fellow May 20 '16 at 07:52
7

D is pretty impressive, and Andrei's book about it is well-written. But as others have said, you need the tools and the platform support. GDC may, over time, be the answer to both.

Have you seen this?

"GNU Debugger adds D language support": http://www.linux.com/news/enterprise/biz-enterprise/358956-gnu-debugger-adds-d-language-support

Also, the digitalmars site has pages discussing interfacing to C and C++ (for those libraries you just can't live without). I wonder if there are any tools that, given a C header file, will take a stab at writing the D prototypes.

Personally I wouldn't at this point push for doing a large project in D, but I would use D for in-house tools, getting experience with it and introducing others to it.

The original question was whether D is a credible alternative to Java and C++. I don't think D and Java are really going to compete much in practice; D competes with C++ and now Go. Other questions address the differences between D and Go, but Go is generally considered easier to use. So I suspect that the future of D depends a lot on how much room there is for it to breathe between C++, the current king of the hill, and Go, the much easier alternative that has Google's backing.

UPDATE: I just discovered that my favorite chapter of Andrei's book, the one on concurrency, is available for free online. Definitely worth a read!

And here's a loooong discussion about the relative merits/objectives/approaches of Go and D.

AmigoNico
  • 6,652
  • 1
  • 35
  • 45
  • I don't know much about Rust; I'm waiting for it to hit 1.0. But you're right, it definitely looks worth watching and appears to play in this same space. – AmigoNico Oct 16 '12 at 20:52
  • 1
    The only thing I don't like about D is the type system. It looks old. OO hierarchies are intrusive. I don't like it as a start point. Rust is better at this. – Germán Diago Dec 11 '14 at 14:52
4

As a language, I always felt that D is closer to C# than C++. Not in features and libraries, but in "feeling". It's much cleaner,nicer ... fun (than C++). IMHO the biggest obstacle in becoming a credible alternative is tools,IDE and debugger. If D overcomes some obstacles of widespread usage/adoption, more tools and libraries will manifest. (I myself will return to D, if there will be an usable IDE and debugger.)

fedvasu
  • 1,232
  • 3
  • 18
  • 38
gerleim
  • 1,389
  • 2
  • 16
  • 28
4

It looks like the question has been answered. D is the better language compared with C++.

The question of whether for practical purposes D has better infrastructure around is secondary.

In short if they are both brand new languages without any support around them D is the better language, ergo it is the better language.

vfclists
  • 19,193
  • 21
  • 73
  • 92
3

Works great for my own pet projects. I'd use it for employers' projects but for not knowing how hard it would be for them to find someone to take over the source after i move on. There are no technical reasons to avoid it, at least on the supported platforms. (knock on wood)

DarenW
  • 16,549
  • 7
  • 63
  • 102
3

It looks like a very well designed language; much better than C - C++ - Objective C. I can live without an IDE or a debugger for a while, but not without a good, documented library for D 2.0.

I'll check back in 6 months...

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
3

One approach is to search for jobs in your area. Find the jobs you would like to do and see what skills they are asking for. If they are asking for C++ or Ruby or Oracle or D, then that is the skill which is mostly to help you to get the job you want.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130