Design by ContractBertrand Meyer

Design by Contract

by Bertrand Meyer · first published 2020

20mentions
4recommended by
9HN commenters
2015–2026first – last mentioned

44% recommend56% neutral

Affiliate links. As an Amazon Associate I earn from qualifying purchases.

Mentions per year

20 2007: 0 mentions2008: 0 mentions2009: 0 mentions2010: 0 mentions2011: 0 mentions2012: 0 mentions2013: 0 mentions2014: 0 mentions2015: 2 mentions2016: 2 mentions2017: 0 mentions2018: 1 mention2019: 2 mentions2020: 0 mentions2021: 1 mention2022: 1 mention2023: 2 mentions2024: 1 mention2025: 1 mention2026: 1 mention200720172026

What Hacker News says

  • mikhailfranco · Apr 4, 2019 · Recommends

    Eiffel has loop invariants, for example see: http://se.ethz.ch/~meyer/publications/methodology/invariants... Also see Meyer's Design By Contract book, which you should read even if you will never use Eiffel - it's a gem.

    on “Loop invariants can give you coding superpowers” ↗
  • rramadass · Mar 31, 2021 · Recommends

    Also read Robert Floyd's paper Assigning Meanings to Programs. After getting the gist of the above, reading Bertrand Meyer's Design by Contract and Applying Design by Contract will clarify on how to apply the ideas to "real" systems.

    on “An Axiomatic Basis for Computer Programming (1969) [pdf]” ↗
  • nickpsecurity · Feb 12, 2019 · Recommends

    …can do all that if you build thetoing for given language and platform. Static typing is a subset of formal specifications. I suggest using the other phrase so they find more interesting stuff. Meyer's Design-by-Contract is an easy one you can do in basically any language.

    on “The memory safety problem isn't bad coders” ↗
  • rramadass · Mar 29, 2021 · Recommends

    The paper "Applying Design by Contract" by Bertrand Meyer shows how DbC is to be used. It is sufficient to have only preconditions turned on by default in "release" mode, others are optional. My thumb rule is to have all preconditions/postconditions/invariants…

    on “Ada for the C++ and Java Developer [pdf]” ↗
  • rramadass · Mar 29, 2021 · Recommends

    …program correctness design constructs. Thus it is a systematic (i.e. not ad-hoc) way of using asserts correctly to guarantee program state. I highly recommend reading Bertrand Meyer's papers "Applying Design By Contract" and "Design by Contract". They are well worth every programmer's time.

    on “Ada for the C++ and Java Developer [pdf]” ↗
  • rramadass · May 3, 2022 · Recommends

    PSA: The above DbC wikipedia page contains a link to the paper Applying Design by Contract by Bertrand Meyer which is THE paper to read to learn usage.

    on “Ask HN: What helped you get good at programming?” ↗
  • renox · Jan 1, 2023 · Recommends

    …contracts is that they can be enabled at runtime, so very different from UT. Also different from assertions in that 'class' invariants applies to every public method of the class. : All I know about 'Design by Contract' I learned it in the (very good IMHO) book Object Oriented Software Construction by Bertrand Meyer (he made the Eiffel language).

  • rramadass · Jun 26, 2023 · Recommends

    …rather than the details of the Eiffel language (not necessary during the first pass). It is a huge book so skip topics as needed to focus on the essential concepts. You should also look into Meyer's "Design By Contract" technique for writing "correct" OO and other-paradigm programs. This is of great value in real-world programming. PS: You might also find another Meyer's book Agile! The Good, the Hype and the Ugly…

    on “Object-oriented Programming with ANSI-C (1993) [pdf]” ↗
  • rramadass · Nov 14, 2024 · Recommends

    Interesting. I am a fan of DbC (following Meyer's Applying "Design by Contract" - pdf at https://se.inf.ethz.ch/~meyer/publications/computer/contract...) though due to runtime costs (as you point out) i limit it to pre-conditions only everywhere (almost all "policy" part of the…

    on “Contracts for C++ (DbC) [pdf]” ↗
  • rramadass · Jan 22, 2025 · Recommends

    …concepts here, you can apply them explicitly even if your language does not support the needed syntax (eg. Contracts). See Bertrand Meyer's OOSC2 for details - https://bertrandmeyer.com/oosc2/ Specifically "Design-by-Contract (DbC)" and "Inheritance Techniques" and "Using Inheritance well". Also relevant is my other comment here - https://news.ycombinator.com/item?id=42788947

    on “Liskov Substitution: The real meaning of inheritance” ↗
  • rramadass · Oct 15, 2026 · Recommends

    You need to study Bertrand Meyer's "Design by Contract" and "Applying Design by Contract" papers - https://news.ycombinator.com/item?id=48358691 There are also ways to turn runtime contract checks into static verification checks. See my other comment for…

    on “C++26 Contracts: Introduction to Preconditions and Postconditions” ↗
  • rramadass · Jun 1, 2026 · Mentions

    Asserts in any language must not be added willy-nilly but following a specific methodology viz. Design By Contract (DbC) - https://en.wikipedia.org/wiki/Design_by_contract DbC was first introduced in Eiffel but the ideas can be used in any language. See the following; 1) Design by Contract and Assertions - https://www.eiffel.org/doc/solutions/Design_by_Contract_and_...…

    on “You Must Fix Your Asserts (Zig)” ↗
  • gwright · Nov 5, 2018 · Mentions

    The best description of exceptions that I've seen is Bertrand Meyer's exposition of them in _Object Oriented Software Construction_. His definition depends on the notion of Design by Contract. An exception is an event that causes a function/method to fail because it is unable to satisfy its contract. The caller is then responsible for cleaning things up (so it can satisfy its contract) or…

    on “Programming Paradigms for Dummies: What Every Programmer Should Know (2009) [pdf]” ↗
  • AdieuToLogic · Jul 14, 2015 · Mentions

    Your background immediately reminded me of Betrand Meyer and Design by Contract[1]. I wonder how much of Hoare's work influenced Meyer. Do you care to opine? :-) 1 - http://www.artima.com/intv/contracts.html

    on “Floyd–Hoare logic” ↗
  • mcguire · Jul 14, 2015 · Mentions

    I don't know much about Meyer's history and the history of Design by Contract, but I'm going to go out on a limb and say, "quite a bit." The major difference that I can see, with my limited experience, is that DbC seems to be focused on the boundaries between functions and is more…

    on “Floyd–Hoare logic” ↗

Keyboard shortcuts

/
Focus search
j / k
Next / previous book
Enter
Open focused book
Esc
Close / go back
g h
Go to Home
g t
Go to Top all-time
g m
Go to Most recommended
g r
Go to Rising
g f
Go to For You
?
Show this help