Carlos D. Rivera February 28, 2007 Design-by-Contract.

Slides:



Advertisements
Similar presentations
Where Agile Meets Formal Methods
Advertisements

Formal techniques for getting software right: some old ideas and some new tools Applied Formal Methods Research Group David Lightfoot:
Design by Contract.
Presenter: Chris Treml
Copyright W. Howden1 Programming by Contract CSE 111 6/4/2014.
Building Bug-Free O-O Software: An Introduction to Design By Contract A presentation about Design By Contract and the Eiffel software development tool.
ISBN Chapter 3 Describing Syntax and Semantics.
1 Design by Contract Building Reliable Software. 2 Software Correctness Correctness is a relative notion  A program is correct with respect to its specification.
Feb 2003 R McFadyen1 Contracts (Ch 13) Used to help understand requirements more completely based on assertions; assertions are applicable to any.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
Software Engineering and Design Principles Chapter 1.
Jan 2005 Ron McFadyen1 Contracts Used to help understand requirements more completely (and so may not always be necessary) based on assertions;
Software Testing and Quality Assurance
Static and Dynamic Contract Verifiers For Java Hongming Liu.
OOP #10: Correctness Fritz Henglein. Wrap-up: Types A type is a collection of objects with common behavior (operations and properties). (Abstract) types.
Karlstad University Computer Science Design Contracts and Error Management Design Contracts and Errors A Software Development Strategy (anpassad för PUMA)
C SC 520 Principles of Programming Languages 1 C SC 520: Principles of Programming Languages Peter J. Downey Department of Computer Science Spring 2006.
©Ian Sommerville 2000Software Engineering, 6/e, Chapter 91 Formal Specification l Techniques for the unambiguous specification of software.
Feb. 23, 2004CS WPI1 CS 509 Design of Software Systems Lecture #5 Monday, Feb. 23, 2004.
September 2002 R McFadyen1 Domain Model Use Case Model text diagram SSD System operation contracts Design Model Figure 13.3.
CSC 395 – Software Engineering Lecture 21: Overview of the Term & What Goes in a Data Dictionary.
Describing Syntax and Semantics
Eiffel Language and Design by Contract Contract –An agreement between the client and the supplier Characteristics –Expects some benefits and is prepared.
Adding Contracts to Ada Ehud Lamm Adding Design By Contract to Ada.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 10 Slide 1 Formal Specification.
1 © Wolfgang Pelz Design by Contract Design by Contract™ Based on material drawn from: Bertrand.
MCA –Software Engineering Kantipur City College. Topics include  Formal Methods Concept  Formal Specification Language Test plan creation Test-case.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 10 Slide 1 Critical Systems Specification 3 Formal Specification.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 10 Slide 1 Formal Specification.
Computer Science 340 Software Design & Testing Design By Contract.
Ranga Rodrigo. Class is central to object oriented programming.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 9 Slide 1 Formal Specification l Techniques for the unambiguous specification of software.
Lecture 16 March 22, 2011 Formal Methods CS 315 Spring Adapted from slides provided by Jason Hallstrom and Murali Sitaraman (Clemson)
Computer Science School of Computing Clemson University Introduction to Formal Specification Murali Sitaraman Clemson University.
Contract based programming Using pre- and post-conditions, and object invariants Contract based programming1.
Overview of Formal Methods. Topics Introduction and terminology FM and Software Engineering Applications of FM Propositional and Predicate Logic Program.
WXGE6103 Software Engineering Process and Practice Formal Specification.
Design by Contract in Java Concept and Comparison.
Modeling and simulation of systems Model building Slovak University of Technology Faculty of Material Science and Technology in Trnava.
More About Classes Ranga Rodrigo. Information hiding. Copying objects.
School of Computing and Mathematics, University of Huddersfield CIA2326: Week 11 LECTURE: Formal Specification TUTORIAL/PRACTICAL: Finish off last weeks.
Software Engineering in the Academy Bertrand Meyer IEEE Computer, May 2001.
1 Software Requirements l Specifying system functionality and constraints l Chapters 5 and 6 ++
(SRS) SOFTWARE REQUIREMENT SPECIFICATION(SRS) 1. Topics to be discussed.. What is an SRS? Purpose of an SRS Who reads the SRS? Who writes the SRS? Characteristics.
1 Devon M. Simmonds, Computer Science Department Design by Contract Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington.
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
L13: Design by Contract Definition Reliability Correctness Pre- and post-condition Asserts and Exceptions Weak & Strong Conditions Class invariants Conditions.
SWE 4743 Abstract Data Types Richard Gesick. SWE Abstract Data Types Object-oriented design is based on the theory of abstract data types Domain.
Defensive Programming CNS 3370 Copyright 2003, Fresh Sources, Inc.
Chapter 2 Comments, Conditions, Assertions Comments Preconditions Postconditions Assertions.
DBC NOTES. Design By Contract l A contract carries mutual obligations and benefits. l The client should only call a routine when the routine’s pre-condition.
Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.
Design by Contract. The Goal Ensure the correctness of our software (correctness) Recover when it is not correct anyway (robustness) Correctness: Assertions.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
Formal Specification.
Design by Contract Jim Fawcett CSE784 – Software Studio
Design by Contract Jim Fawcett CSE784 – Software Studio
Used to help understand requirements more completely
Software Engineering in the Academy
Arab Open University 2nd Semester, M301 Unit 5
Design by Contract in Python: Present and Future Aaron Bingham
Software Engineering in the Academy
Programming Languages 2nd edition Tucker and Noonan
Reliable Objects: Lightweight Testing for OO Languages
Design by contract Object-Oriented Software Construction by Bertrand Meyer, Prentice Hall The presence of a precondition or postcondition in a routine.
Design by contract Object-Oriented Software Construction by Bertrand Meyer, Prentice Hall The presence of a precondition or postcondition in a routine.
Assertions References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 4/25/2019.
Computer Science 340 Software Design & Testing
Programming Languages 2nd edition Tucker and Noonan
Formal Methods Lecture 16 March 22, 2011 CS 315 Spring 2011
Presentation transcript:

Carlos D. Rivera February 28, 2007 Design-by-Contract

WHAT ? Design-by-Contract (DBC) is a methodology for designing computer software.

WHAT ? Design-by-Contract (DBC) is a methodology for designing computer software. Define checkable interface specifications

WHAT ? Design-by-Contract (DBC) is a methodology for designing computer software. Define checkable interface specifications Theory of abstract data types (e.g., interfaces)

WHAT ? Design-by-Contract (DBC) is a methodology for designing computer software. Define checkable interface specifications Theory of abstract data types (e.g., interfaces) Metaphor of business contract (e.g., pre-, post-)

HISTORY Bertrand Meyer

HISTORY Bertrand Meyer Eiffel

HISTORY Bertrand Meyer Eiffel Object-Oriented Software Construction

HISTORY Bertrand Meyer Eiffel Object-Oriented Software Construction DBC circa 1986

INTRODUCTION Design-by-Contract is a thinly veiled mathematical proof.

FOUNDATION Design-by-Contract :

FOUNDATION 1. Abstract Mathematical Models of a System this phenomena can be represented by this mathematical language Design-by-Contract :

FOUNDATION 1. Abstract Mathematical Models of a System this phenomena can be represented by this mathematical language 2. Formal Specification this mathematical model will produce this, always Design-by-Contract :

FOUNDATION 1. Abstract Mathematical Models of a System this phenomena can be represented by this mathematical language 2. Formal Specification this mathematical model will produce this, always 3. Formal Verification we can check if the specification is true for every case Design-by-Contract :

OVERVIEW Object-oriented process commonly implemented using assertions.

OVERVIEW Object-oriented process commonly implemented using assertions. Assertion benefits :

OVERVIEW Object-oriented process commonly implemented using assertions. Assertion benefits : Program correctness/testing

OVERVIEW Object-oriented process commonly implemented using assertions. Assertion benefits : Program correctness/testing On/off during development

WHY ? Benefits of DBC :

WHY ? 1. Clear design process Benefits of DBC :

WHY ? 1. Clear design process 2. Inheritance Benefits of DBC :

WHY ? 1. Clear design process 2. Inheritance 3. Exception handling Benefits of DBC :

WHY ? 1. Clear design process 2. Inheritance 3. Exception handling 4. Automatic software documentation Benefits of DBC :

HOW ? Client-Supplier business relationships.

HOW ? Client-Supplier business relationships. Basis: Pre-condition If you have the right amount of money If input values within specified range Expectations

HOW ? Basis: Post-condition You will get this product It will be transformed to this result Guaranteed Client-Supplier business relationships.

HOW ? Basis: Class Invariant Under these conditions Object analysis invariant { assert ( ); } Maintain Client-Supplier business relationships.

CONCLUSION Analogy :

CONCLUSION Analogy : Molds can be used to make copies of objects with negligible variation.

CONCLUSION Analogy : Molds can be used to make copies of objects with negligible variation. Assertions can be used to create validated clones of ADTs of precise definition.

CONCLUSION Even though Design-by-Contract may seem straight-forward and almost routinely basic, its importance lies in its power to create a type of mutually agreed upon business contract, equally understandable to both the client and developer, that scientifically maps a problem-solving mathematical model to the clients needs.

CONCLUSION Most importantly, the documentation provided by DBC creates a contract whereby requirements can be specified and met without avail.

CONCLUSION Most importantly, the documentation provided by DBC creates a contract whereby requirements can be specified and met without avail. Questions, Concerns, Complaints ?