eXtreme Programming (XP) is a lightweight software engineering methodology, conceived by Kent Beck, with a strong focus on business vale. Design by Contract is a software design technique defined by Bertrand Meyer that stresses stability and maintainability of large systems. The two are regarded as incompatible by many of their respective followers.
Hasko Heinecke and Christian Noack elaborated why contracts can nonetheless offer benefits to XP and how they can be used in an XP environment. Contracts are particularly belpful in large systems development, an area that has not yet been well investigated by the XP community. The authors have published their approach of combining Design by Contract and eXtreme Programming in eXtreme Programming Perspectives, Addison-Wesley, 2003.
Design by Contract is certainly not a core practice of XP, but neither does it contradict the XP values. It has been shown that Design by Contract does offer benefits in an XP environment, if wisely applied. In particular, large systems efforts can use contracts to specify and document their subsystems’ semantics to a certain degree.
If you want to find out more, we suggest to read the book.