Unclear about the benefits of D over C++ and Java

Shannon via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 3 10:39:21 PST 2016


On Sunday, 3 January 2016 at 15:38:18 UTC, Dibyendu Majumdar 
wrote:
>
> I am looking to choose between D, Swift and Rust for a project 
> that I am currently coding in C++. So far D seems the 
> alternative but I guess I won't know until I try out a few 
> things.

Why I now choose D, even for commercial jobs...

C++ had been my primary language (personally and professionally) 
for 20 years, and it was effective and enjoyable for me.  But, I 
was naive.  I didn't realize that what made it enjoyable for me, 
is that I always used effective and complete frameworks/toolsets 
(IBM VisualAgeC++ on OS/2, BeOS standard API, Qt on everything) 
with effective base classes and data structures that all worked 
together.  When forced out of my comfortable space, by a project 
a couple years ago that allowed no dependencies on Qt, I 
discovered the grief of C++.

So, time to give D a try.  I'd watched it through the tumultuous 
years, and saw that it had settled down. I like the pedegree of D 
- a pragmatic approach from a creator of a commercial C++ 
compiler.  Also, I was encouraged to see Alexander jump in to 
contribute to D (even before the D foundation announcement), as 
he's been tirelessly working to improve C++ over the years.

I, like you, wanted to "try out a few things" before committing 
to D on commercial effort. I found myself fantastically 
productive (more than C++, even with Qt) using rdmd to begin 
script-like and refactor as it grew. Easy, like Python that 
produces fast compiled single executables that are easy to deploy 
(even to folks without a Python development environment 
installed), especially with the 'import' feature to embed 
external resources.  It is so easy to keep unit tests current and 
running, and so easy to see testing code coverage, that I felt 
always safe refactoring.  I appreciate the ability to mark any 
scope @safe, and have the compiler keep me honest.

And I found myself using more "esoteric" features that were a 
pain in C++.  I loved the concept of meta-programming in C++, but 
always found myself using features in my framework - which had 
taken the great pains to provide the necessary functionality.  I 
found implementing threads and concurrency in D every bit as 
simple and safe as Qt.

Admittedly, GUI stuff in D is a mixed bag.  I've settled on 
creating D console applications that transmits json data, via 
stdin/stdout, directly into Qt base model classes so the rest of 
the Qt framework works seamlessly.  I quite like the solution, 
and I'm actually glad there was no "standard" gui interface that 
bound me.  But, gtk and sdl bindings seemed to work easy enough 
for simple things, and dlanggui is looking promising.

As for future commercial efforts, I'll continue with D.  I feel 
safe that straight C is relatively easy to integrate.  Having 
access to proven libs like sqlite, redis, libgit2, nanomsg makes 
little incentive to ever feel like replacing them.  Even many of 
the interesting Python libs are just linked to a standard C lib 
underneath.

Anyway, I'm just more productive at producing robust, fast code 
in D.
Best of luck in your efforts.


More information about the Digitalmars-d mailing list