How does D improve design practices over C++?

Walter Bright newshound1 at digitalmars.com
Thu Nov 6 21:06:13 PST 2008


Don wrote:
> Tony wrote:
>> I write unit tests. I don't know why I'd need or want language support 
>> for that.
> 
> Yes, it's simple syntax sugar. But in practice, it really seems to 
> dramatically affect the number of unit tests that actually get written.

It is amazing what a difference just a little sugar will do. It puts it 
past the tipping point. I've run across an awful lot of C/C++ code in my 
career written by professionals. Very few of those had any sort of 
organized test code. But the opposite seems to be true with D. By 
supporting it directly in the syntax, code just looks half-baked if it 
doesn't have unittests and Ddoc documentation. That little push makes 
all the difference.

It also helps with the management of code. It makes it easy to enforce a 
rule of "public functions shall have unit tests and ddoc comments." 
Before ddoc, the Phobos documentation was an embarrassing mess. I 
wouldn't exactly call it the greatest now, but the improvement has been 
spectacular, and ddoc is the driver behind that.



More information about the Digitalmars-d mailing list