Making D better than other programming languages (warning: rant, drivel)

Walter Bright newshound at digitalmars.com
Sun Oct 29 21:19:53 PST 2006


LaggedOnUser wrote:
> The best metric for productivity across languages appears to be Lines of Code (LOC).  The productivity for a typical programmer is inversely
> proportional to the number of lines of code he/she has to write.

I agree. My experiments with real D projects compared with their 
equivalent C++ ones is that the D ones about about 30% less source code.
If the proportionality rule applies, that makes it 30% more productive.

> That "something else" is probably the fact
> that both are essentially dynamically-typed, easy-to-use, scripting languages that are terse and expressive.

I think the dynamic typing thing along with gc are the big productivity 
drivers.

> In that regard, DMD is far more similar to C/C++/Java, than it is to PHP/Python/Perl/Ruby.
> - DMD is statically typed and compiled, not dynamically typed.  I know, it can be run as a script, but that doesn't change the syntax, so that probably
> doesn't increase coding productivity.

> - DMD is probably no more terse or expressive than Java enough to make a difference

This I strongly disagree with. Java requires a lot more code to get 
anything done. Its saving grace is its very extensive library.

> After all, if moving from C++ to Java seems to provide no productivity gain, then how much could one really gain by moving from Java to DMD?  Perhaps
> not enough to make a difference.

When moving from C++ to Java, you save lines of code in not having to 
deal with memory management, but you pay lines of code because Java 
isn't as expressive. The two effects may just cancel each other out, 
leaving the observed result.

> Another problem in general with programming languages and environments, in my opinion, is that they pay insufficient attention to usability
> engineering.  They simply don't take an evidence-based, quantitative approach to language design, rather relying on "intuition" about what works, which
> is often overhyped and fallible.

While true that D isn't based on scientific studies, it *is* based on a 
great deal of practical programming experience both of myself and 
others, and studies that I have read. One result of this is you don't 
see D features being all forced to fit one all-encompassing slogan like 
some other languages do.


> The claims about object-oriented software productivity are quite overhyped, for example, and studies don't bear that
> out either.

True, and D doesn't force an OOP approach to everything.

> Based on these and other considerations, here are my recommendations for improving Digital Mars D and making it competitive/superior to other languages:
> 
> 1. Pay attention to the evidence of research studies into programming language productivity and usability and apply them to Digital Mars D where
> applicable, rather than mere intuition or hype.

I believe D does.

> It would be better if you were able to back up claims about the language with actual facts or
> research.  To this end, Digital Mars could possibly offer itself as a subject for academic study/research.

The facts that do exist for D do support the claims, but such would be a 
  lot clearer if the language was heavily used in industry.

> 2. Increase the "scalability" or "portability" of Digital Mars to the scripting world.  I know, there is DMDScript, but that is not what I'm talking
> about.  The problem with DMDScript is that it is really ECMAScript, so the user of ECMAScript has to learn a brand new language.

DMDScript isn't a D scripting language, it's ECMAScript implemented using D.

> It would be better if
> there were one DMD language that scaled all the way from interactive programming (like Python/Ruby), to dynamically-typed web scripting (like
> PHP/Perl/etc), to browser-scripting (like ECMAScript), to GUI programming, to in-browser GUI development (like Java), etc.  Having a compatible syntax
> for all these different tasks would make D far more scalable and portable as the "one language I need for my programming department to learn".  Such a
> language could go from easy-to-learn scripting for noobs up to professional statically-typed compiled language within the same exact syntactic
> framework.  This is rather like the way Mercury builds on top of Prolog, if you've ever studied those languages.

D with the -run switch can actually be used much like a scripting 
language. Several people here use it that way.

> 3. Provide a richer library with a large vocabulary of built-ins so that programmers don't have to re-invent the wheel.

Yes.

One thing you mentioned as a proven productivity booster is dynamic 
typing. D isn't going to do dynamic typing, but its type inference 
support is getting much better, to the point where one does not need to 
explicitly say nearly so many types.



More information about the Digitalmars-d mailing list