Skip to main content

3 posts tagged with "Design by Contract"

Design by Contract as originated by Bertrand Meyer, emphasizing preconditions, postconditions, and invariants.

View All Tags

More on Design by Contract - Assertions and Inheritance

· 4 min read
Kenny Pflug
Kenny Pflug
Engineering Manager at TELIS/GWVS, Conference Speaker, Consultant

My previous two posts about Bertrand Meyer's Design by Contract (DbC) were mainly introductions to pre- and post-conditions and class invariants and how they can be implemented in C# – in this one we'll check out what implications DbC has if it is combined with the inheritance mechanism of object-oriented programming languages.

More on Design by Contract – Class Invariants

· 10 min read
Kenny Pflug
Kenny Pflug
Engineering Manager at TELIS/GWVS, Conference Speaker, Consultant

In one of my last posts, I discussed the basics of Bertrand Meyer's Design by Contract, namely pre- and post-conditions on methods. These Boolean assertions are used to check if the caller supplied valid arguments and performed the call while the target object was in a valid state, as well as to verify that the method produced the correct return value and/or side effects after it executed completely. This allows us to give semantic meaning to methods on our objects.

In this post, we will go one step further and discuss what class invariants are.

About Guard Clauses, Automated Tests, and Design by Contract

· 9 min read
Kenny Pflug
Kenny Pflug
Engineering Manager at TELIS/GWVS, Conference Speaker, Consultant

I'm currently reading Bertrand Meyer's "Object-Oriented Software Construction" (finally, I should say) and I'm absolutely amazed. Part of the reason I haven't touched this book yet is its age: the second edition was released in 1998. A book that is now 17 years old (the first edition being even ten years older) – what could I learn from it, especially in a field like software development where things change relatively fast?