Slashdot Mirror


Design by Contract in C++?

An anonymous reader asks: "I have read some of the stuff on Eiffel, watched their tutorial videos about design by contract, and the entire thing sounds like a pretty good idea. However, the problem is that we don't use Eiffel at work, and I highly doubt I could get people to come around to the idea of switching to it. Although we use a lot of C++, I can imagine that a lot of the ideas from Eiffel can be applied there. I have looked around on the net and found a few articles talking about different ways of applying design by contract using assert statements and the like. I also found the dlib C++ library on SourceForge which, among other things, puts a design by contract face on a lot of API calls. So, there are obviously people doing it. What is everyone's experience with Design by Contract in C++? What tools are there that help make it a workable system? Lastly, are there any pitfalls to taking this approach in C++?"

1 of 114 comments (clear)

  1. Contracts in Another Language by bheilig · · Score: 0, Offtopic

    > -----Original Message-----
    > From: James Heliotis [mailto:jeh@...]
    >
    > I have a student who is interested in doing a project adding
    > design-by-contract assertions to another language. To my memory,
    > I have never seen anything about how assertions are implemented in
    > EiffelStudio, and what the challenges and pitfalls were. Can anyone
    > point me to any documentation?
    >
    > Thanks a lot,
    > James

    Dear Jim:

    Your student should find the following links useful:

    http://www.phact.org/e/dennis4.html
    http://mathworld.wolfram.com/CircleSquaring.html
    http://chemistry.about.com/cs/generalchemistry/a/a a050601a.htm

    Hope this helps,

    -- Bertrand Meyer

    http://tech.groups.yahoo.com/group/eiffel_software /message/3558