December 26, 2006
Say you wanted to introduce a programmer friend to D. She might know one of D's sibling languages (Java, C, C++, or C#), but you shouldn't rely too much on that. What features of D would you describe first to hook that friend in?

Andrei
December 26, 2006
"Andrei Alexandrescu (See Website For Email)" <SeeWebsiteForEmail@erdani.org> wrote in message news:45917146.9020008@erdani.org...
> Say you wanted to introduce a programmer friend to D. She might know one of D's sibling languages (Java, C, C++, or C#), but you shouldn't rely too much on that. What features of D would you describe first to hook that friend in?

It might not sound like much, but built-in associative arrays and dynamic arrays.  I have never found a more powerful combination of containers.  I can do so much with just these two types.


December 26, 2006
Arrays:
Built-in Dynamic and Associative Arrays
Slicing [..]
Concatenation ~

Nested Functions - Which can access everything in the parent function

Mixins

Static If

Lazy Arguments

Tuples

And best of all - No runtime required!
December 26, 2006
You won't impress much your Java and C# friends unless they care about speed.  So for them it's speed.

For C/C++, I would go with class design (by reference only, garbage colleted, always virtual, easy initialization) and still mention speed.

December 26, 2006
Andrei Alexandrescu (See Website For Email) wrote:
> Say you wanted to introduce a programmer friend to D. She might know one of D's sibling languages (Java, C, C++, or C#), but you shouldn't rely too much on that. What features of D would you describe first to hook that friend in?
> 
> Andrei

I'd have to say the #1 thing that makes D great is the combination native code speed with the ease of development offered by built-in garbage collection.  After that come niceties like nested functions and class delegates.  And if you're into templates then D's templates are very nice and enable a lot of nifty things that are difficult to do in C++ -- (static if! variadic templates & tuples!).  The lack of need for header files is another plus.  It gets very tiring having to type every function signature twice in C++.

There are lots of other little minor things that make D nicer to use than C/C++ and other alternatives (I put built-in arrays in this category), but to me those aren't the biggies.

The ability to call C code without a lot of messy JNI-like boilerplate code is also a big deal.


I wholeheartedly agree with Waldemar, though, that the things that are going to sway C/C++ folks are different from what's going to sway Java/C# folks.  D's library and development tools are still rather anemic, so most likely that would send most Java/C# folks running.  On the other hand, if they find they need to deliver an app that works stand-alone, independent of a 100MB runtime environment, or one which runs at native speed, then D is probably the closest thing they're going to find to their beloved Java/C# that can do the job.

--bb
December 26, 2006
Andrei Alexandrescu (See Website For Email) wrote:
> Say you wanted to introduce a programmer friend to D. She might know one of D's sibling languages (Java, C, C++, or C#), but you shouldn't rely too much on that. What features of D would you describe first to hook that friend in?

If "you shouldn't rely too much on that" means my arguments should be independent of the newcomer's background, then I give up.

Suppose you're a used-car salesman and you have this better-than-average car to sell. Now, find an argument that works equally well for customers like a redneck, a computer whiz kid, a plumber, a pimp, a family mother, a student, and a grandma.

It's a waste of gunpowder to try to conjure up a universal argument.

---

To somebody without a prior language, I'd say don't, because there aren't any good books out yet.


To a university I'd say: (I've spent 5 years teaching programming in a university)

This is the language you've been waiting for ever since Pascal went out the door. With this language you can teach both the standard C-family imperative programming concepts, as well as an exceptional selection of the more modern concepts.

The language is both clear enough to be used as a first language, and powerful and real-world usable enough to be used for post graduate work, as well as for professional programming. As such it offers an excellent "mother tongue" from which forays into other Algol family languages as well as non-Algol family ones can be made with a minimum of friction.

It can also be argued that if a student ultimately needs to be fluent in C++, he should take programming intro in D, intermediate in D, and only then jump (directly) to advanced C++. Since most of the concepts are common between these languages, the student saves much time and gains a more solid understanding of those concepts with D, where most of his attention doesn't go to ambiguities, exceptions, caveats, or the compiler drowning him or sending him of to wild goose chases in the night.


To a C/C++ programmer I'd say:

Automatic memory management in a compiled language, you don't know what you're missing until you actually try it out! Compile a 5 minute compilation in 15 seconds! What if you could skip using lint altogether? How about never again needing to spend hours explaining to the younger colleagues all about pointer dereferencing and double indirection? Learning curve for C/C++ users: next to nothing!!


To a C++ guru:

Check out the metaprogramming stuff, and what folks have done with it! Double your productivity, honest! And the extra bonus: when's the last time you actually enjoyed programming?


To a C# or Java guy:

Run without the VM!!!!! And get access to the metal, be in real control of the computer!! And you haven't seen this kind of speed since the barrio pushers got busted!


To a code shop boss:

Bounds checking, pre- and post-conditions, unit tests, no header files! And syntax is straightforward enough that you actually can write your own tools for analysis, manipulation, rules enforcement, and code generation! And finally: you won't believe the increase in overall productivity!
December 26, 2006
Andrei Alexandrescu (See Website For Email) wrote:
> Say you wanted to introduce a programmer friend to D. She might know one of D's sibling languages (Java, C, C++, or C#), but you shouldn't rely too much on that. What features of D would you describe first to hook that friend in?

It really depends on what features I think that specific person would be interested in, but those I'd mention to everyone are: inner functions and delegates.  Interestingly, I completely forgot about variable-length arrays and associative arrays, and I think this is because they are such fundamental features of the language.  So add those to the list as well :-)


Sean
December 26, 2006

Andrei Alexandrescu (See Website For Email) wrote:
> Say you wanted to introduce a programmer friend to D. She might know one of D's sibling languages (Java, C, C++, or C#), but you shouldn't rely too much on that. What features of D would you describe first to hook that friend in?
> 
> Andrei

I wouldn't introduce feature X or Y, because they can always find another language with that feature, or even with a better feature.

I would talk about the reason D was developed and how it saves you a lot of time.
December 27, 2006
Andrei Alexandrescu (See Website For Email) wrote:
> Say you wanted to introduce a programmer friend to D. She might know one of D's sibling languages (Java, C, C++, or C#), but you shouldn't rely too much on that. What features of D would you describe first to hook that friend in?
> 
> Andrei

static if/templates

module system

built in string/dynamic array/associative array/bounds check

compile time

not on a VM

new features incorporated very quickly, and no committee to govern what goes in

can call C code
December 27, 2006
== Quote from Andrei Alexandrescu's article
> Say you wanted to introduce a programmer friend to D. She might know one of D's sibling languages (Java, C, C++, or C#), but you shouldn't rely too much on that. What features of D would you describe first to hook that friend in?
>
> Andrei

I've tried introducing D to people, and response varies.  For people that see C++ as having no advantages over C, it's probably an impossible sell.  For people that like C++ but have been working with it long enough to be annoyed at the syntax, the cleaner syntax (especially for template metaprogramming) have made an impression.

The real selling point for me is that it has basically all of the safety and simplicity of use of something like Java, but does not have the handcuff and straight jacket feeling.  The "we are all in this boat and we will all follow the rules" approach of Java, along with some of the more arbitrary missing features (i.e. unsigned types) causes the language to drag when working with high-performance and high-requirement (i.e. number crunching and hardware oriented) fields.

The starting point I use is that it has almost all the features and power of Java and C++ but is cleaner and more usable than Java.  If they are still interested I point them here (http://www.digitalmars.com/d/comparison.html), since I think it's a good jumping off point for a C++ or Java programmer.

There was something about a web server that doesn't need to allocate memory to process requests - I can't find a link for this, but I use it to describe the power of array slicing.

I think these are the most impressive "Why D" type pages:

http://www.digitalmars.com/d/comparison.html http://www.digitalmars.com/d/lisp-java-d.html (esp. if they know lisp) http://www.digitalmars.com/d/templates-revisited.html http://www.digitalmars.com/d/overview.html

And if they don't know anything about GC:

http://www.digitalmars.com/d/garbage.html

For C++, the formula is, find out what they are working on, and show how it can be done much more simply in D.  If they are Java programmers, find out what they are working on, and show how much faster it is in D.

Kevin
« First   ‹ Prev
1 2 3 4 5 6 7
Top | Discussion index | About this forum | D home