48 hour game jam

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Oct 15 14:31:10 PDT 2012


On Mon, Oct 15, 2012 at 10:40:12PM +0200, Paulo Pinto wrote:
> On Monday, 15 October 2012 at 20:33:36 UTC, so wrote:
[...]
> >I have problem with the attitude of some people (not necessarily
> >you). As they say D templates are just better because of things
> >like syntax, other than that you could pretty much do everything
> >you can do with C++ templates (you simply can't). And they just
> >get away with this. For me it just shows how little they know
> >about C++ or D.
> 
> Many people use C++ as better C.

I did, even while knowing C++ has OO constructs like classes,
polymorphism, etc.. The fact of the matter is, OO programming in C++ is
a pain, because C++'s OO wasn't very well designed. It did get the
basics right, mind you, but not much beyond that. There are just so many
loopholes and flaws that trying to do _real_ OO design in C++ is an
exercise in frustration.  I've found that using C++ as "C with classes"
is a much less painful experience than trying to do "real" OO in C++.
For that, I'd recommend Java instead (even though I'm by no means a Java
fan).

(I do use polymorphism, etc., in C++ code, but only barely, in limited
situations. I don't even dare to go near multiple inheritance with a
sterilized 15-foot pole. Java had the right idea with interfaces,
something that I'm glad D picked up.)


> I was amazed to hear that are companies that forbid templates or STL
> code on the videos from Going Native conference organized by
> Microsoft.
[...]

I can totally understand why, even though I don't agree with the
reasons. I've seen C++ gone wrong, horribly horribly wrong, as a result
of over-engineering a system that became unmaintainably complex (and
should I say, unnecessarily so -- it was a case of premature
generalization taken to the extremes). Templates, and by extension STL,
are perceived by many as one of those "unnecessarily complicated"
features of C++, which lets careless programmers write hopelessly
complex and unmaintainable code, so I can totally see PTBs prohibiting
it. I mean, even C++ code written to *be* maintainable often *looks*
unmaintainable due to the horrible template syntax, among other things.
It's the kind of stuff that drives PTBs to ban C++ outright.  (I don't
agree with the assessment of templates, of course, but I can understand
the sentiment.)

If you think forbidding templates/STL is crazy, wait till you hear about
the people who insist that const is evil and ban it from their codebase.
(That was from before C++11, though, I don't know what their reaction
would be now that key parts of the language _require_ const. Maybe
they've migrated to VB or something. :-P)


T

-- 
BREAKFAST.COM halted...Cereal Port Not Responding. -- YHL


More information about the Digitalmars-d mailing list