How does D improve design practices over C++?
Tony
tonytech08 at gmail.com
Mon Nov 3 20:13:24 PST 2008
Let me be facetious with Janderson's list plz...
"Janderson" <ask at me.com> wrote in message
news:ge8tpd$1f6b$1 at digitalmars.com...
> Hi,
>
> I was talking with some collages at work and they asked me how D enforces
> good programming practices. For course I mentioned a couple of the ones
> I knew of hand -
>
> - Unit checking
Not sure what is meant by this, but it sounds minor.
> - Design by contract
Overblown concept, but can be done with C++ also to a more than adequate
degree (heard of assertions?).
> - Invariant checks
Part of DbC concepts. See Koenig and Moo's array example in "Accelerated
C++". Which, btw, leads me to believe that there are few instances "where
the stars line up just right" for invariant checking to be useful.
> - Stronger const
Insignificant. I still use many #defines just because I know that const vars
take space and #defines are a pre-compile-time thing (yes, I value the
preprocessor for some uses, this being one of them).
> - Modules
If that means doing away with header files, I don't think I like it. I rely
on headers as the engineer's blueprint (of course you have to write very
clean code to have that make sense).
> - Garbage collection
That's a major deal breaker for me.
> - No automatic copy constructor
Can't comment.
> - More restrictive operators
I'm not really concerned about that. I'd avoid them unless doing numerical
programming.
> - Delegates (Specifically, encouraging there use by making them simple to
> use)
Can't comment.
> - Specific constructs such as Interfaces
C++ has interfaces. Should it be a keyword? Maybe. How are D's interfaces
different from C++'s?
> - More restrictive casting
Ouch!! I prefer to slice bread with a knife rather than having a machine do
it. (Bad analogy, but y'all get the point).
> - No C style Macros
Implementing a template or template system with a good preprocessor is
something completely different than macros. I value the preprocessor for
such uses (I wish it was more powerful than in C++ though).
Tony
More information about the Digitalmars-d
mailing list