comp.lang.ada
 help / color / mirror / Atom feed
From: Tim Rowe <spamtrap@tgrowe.plus.net>
Subject: Re: Ada vs Eiffel - Ada programmer approach
Date: Tue, 26 May 2009 16:07:06 +0100
Date: 2009-05-26T16:07:06+01:00	[thread overview]
Message-ID: <4vCdnRo6At8-mIHXnZ2dnUVZ8n2dnZ2d@brightview.co.uk> (raw)
In-Reply-To: <8105b65f-4de9-4653-b43a-d55ee33f072d@k2g2000yql.googlegroups.com>

Ludovic Brenta wrote:
> When I read Bertrand Meyer's "Object-Oriented Software Construction",
> I too thought that DbC was a brilliant idea. Now I'm less convinced. I
> see two major drawbacks to DbC:
> 
> - pre/post conditions and invariants involve run-time checks most of
> the time (if not all the time). They slow the program down if enabled,
> or become useless when disabled for performance. I like static
> checking much better; Ada provides a lot of that out of the box (much
> more than Eiffel) and Spark goes way beyond even that.
> 
> - in most of the examples I saw in the literature, only very simple
> subprograms would have a contract and the contract would mostly repeat
> the body of the subprogram. This redundancy is counter-productive. For
> more complex subprograms, it can be very difficult to write pre and
> postconditions and invariants; Ada's pragma Assert provides what I
> need in these (rare) cases  because I can put such pragmas in the
> middle of a subprogram, for example.


I still think it's a brilliant idea, but suffers from *Design* by 
Contract getting confused with *Programming* by Contract; not least 
because "Design by Contract" is a trademark, so people needed a 
different name to refer to the approach, but I'm not sure Bertrand Meyer 
always kept the distinction clear either.

Both of the problems you describe are programming issues, not design 
issues.  There's nothing about the *design* process that mandates any 
run-time checks or that requires you to have pre- and post-conditions 
expressed in the target language. That's a matter for coding standards. 
To me, Design by Contract simply means working out and documenting in 
advance under what circumstances a section of code can legitimately be 
entered, and, if that is satisfied, what we can guarantee on exit. 
Learning to do that rigorously and diligently has certainly improved my 
own design.

We had that before Meyer coined the term "Design by Contract" of course. 
We used to call it "specification" ;-)



  parent reply	other threads:[~2009-05-26 15:07 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-24  8:39 Ada vs Eiffel - Ada programmer approach Tomek Walkuski
2009-05-24 11:49 ` anon
2009-05-24 12:26   ` Georg Bauhaus
2009-05-24 12:17 ` Georg Bauhaus
2009-05-24 16:31 ` Pascal Obry
2009-05-25 16:32   ` Rugxulo
2009-05-26 13:37   ` Ludovic Brenta
2009-05-26 14:51     ` Dmitry A. Kazakov
2009-05-26 17:26       ` Georg Bauhaus
2009-05-26 17:39         ` Dmitry A. Kazakov
2009-05-26 17:59           ` Georg Bauhaus
2009-05-26 19:52             ` Dmitry A. Kazakov
2009-05-26 20:14               ` Pascal Obry
2009-05-26 20:25                 ` Pascal Obry
2009-05-26 21:28                 ` Dmitry A. Kazakov
2009-05-26 18:23       ` Jeffrey R. Carter
2009-05-26 15:07     ` Tim Rowe [this message]
2009-05-26 16:37       ` Georg Bauhaus
2009-05-28  8:37         ` Nicholas Paul Collin Gloucester
2009-06-01 16:22         ` Tim Rowe
2009-06-04  7:35       ` Hibou57 (Yannick Duchêne)
2009-06-04  9:46         ` Martin
2009-06-04 12:16           ` Hibou57 (Yannick Duchêne)
2009-06-04  9:56         ` Jean-Pierre Rosen
2009-06-16  6:58         ` ardjussi
2009-06-16 17:22           ` Jeffrey R. Carter
2009-05-26 18:21     ` Jeffrey R. Carter
2009-05-26 18:35       ` Dmitry A. Kazakov
2009-06-04  7:39       ` Hibou57 (Yannick Duchêne)
2009-06-04  9:02         ` Ludovic Brenta
2009-06-04  9:19           ` Dmitry A. Kazakov
2009-06-04 12:14             ` Hibou57 (Yannick Duchêne)
2009-06-04 14:14               ` Dmitry A. Kazakov
2009-06-04 16:45         ` Jeffrey R. Carter
2009-06-04  7:30     ` Hibou57 (Yannick Duchêne)
2009-06-04  7:55       ` Ludovic Brenta
2009-06-04  8:45         ` Georg Bauhaus
2009-06-04  9:03           ` Ludovic Brenta
2009-06-04 13:25         ` Robert A Duff
2009-06-04 13:39           ` Martin
2009-06-04 13:08             ` stefan-lucks
2009-06-08 12:41           ` Samuel Tardieu
2009-06-08 19:37             ` Robert A Duff
2009-06-08 22:52               ` Randy Brukardt
2009-06-09  7:39                 ` Dmitry A. Kazakov
2009-06-10  6:55               ` Hibou57 (Yannick Duchêne)
2009-06-10  6:58               ` Hibou57 (Yannick Duchêne)
2009-06-10 11:10                 ` Georg Bauhaus
2009-06-04  7:04   ` Hibou57 (Yannick Duchêne)
2009-06-04  6:04 ` Hibou57 (Yannick Duchêne)
2009-06-06 14:27   ` Marco
2009-06-06 15:37     ` Tomek Wałkuski
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox