Re: Type System as Design Tool [Was: We do not use C++ exceptions]
Thant Tessman wrote:
David Abrahams wrote:
on Thu Feb 19 2009, Thant Tessman <thant.tessman-AT-gmail.com> wrote:
[...]
If you want to know what 'contract' means in this context, why don't you
start here: http://en.wikipedia.org/wiki/Design_by_contract
Yes, I read it. More than that, my introduction to design-by-contract
came from reading Meyer's "Object-oriented Software Construction"
literally twenty years ago when it first came out. At the time, I
thought OO was the coolest thing since sliced bread, but even then this
design-by-contract thing seemed a little goofy. Of course it's a good
thing to define "formal, precise and verifiable interface specifications
for software components" etc. It's this (in my opinion misguided)
attempt to ritualize it that I'm trying to draw attention to.
It's like the difference between inheritance and subtyping polymorphism.
In C++ inheritance is a mechanism for providing for subtyping
polymorphism. The problem is that some programmers fixate on inheritance
and lose sight of the fact that it's subtyping polymorphism that's
important, not inheritance as such.
Or the concept of "ownership." Thinking about things in terms of
"ownership" is a great way in C++ to help manage the task of allocating
and deallocating resources. But there are plenty of C++ programmers who
start thinking that the notion of "ownership" is valuable in and of
itself--which simply isn't true.
Wait, what? In the words of Yogi Berra, this is deja vu all over again.
A claim that does not make any sense is being made, then people take the
time to explain how and why it does not make sense, after which you
change the claim without acknowledging it. A lot of people who are
pretty serious about type systems think that ownership is a central
notion of software engineering. Sheesh. I hope I'm not falling for this
again, so I'll limit myself to a simple tidbit of advice: Google
"ownership types" and/or "Jonathan Aldrich".
Andrei
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]