Finding Implicit Contracts in .NET Components

  • Karine Arnout
  • Bertran Meyer
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2852)


Are contracts inherent in reusable libraries, or just one design technique among others? To help answer this question, we performed an empirical study of library classes from the .NET Collections library, which doesn’t use Design by ContractTM, to look for unexpressed contracts. This article reports on the buried contracts we have found, and discusses improvements to the architecture – especially to the libraries’ ease of learning and ease of use – that may result from making the contracts explicit. It extends previous reports [3,4,5,6] with an analysis of the benefits of an a posteriori addition of contracts for the library users.


Design by ContractTM Library design Reuse Implicit contracts .NET Metadata Contract Wizard Eiffel 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Arnout, K., Simon, R.: The.NET Contract Wizard: Adding Design by Contract to languages other than Eiffel. In: TOOLS 39 (39th International Conference and Exhibition on Technology of Object-Oriented Languages and Systems), July 2001, pp. 14–23. IEEE Computer Society, Los Alamitos (2001)CrossRefGoogle Scholar
  2. 2.
    Arnout, K.: Eiffel for.NET: An Introduction. Component Developer Magazine (September- October 2002), Available from (Accessed October 2002)
  3. 3.
    Arnout, K., Meyer, B.: Extracting implicit contracts from.NET components. Microsoft Research Summer Workshop 2002, Cambridge, UK, September 9-11 (2002), Available from (Accessed September 2002)
  4. 4.
    Arnout, K.: Extracting Implicit Contracts from.NET Libraries. 4th European GCSE Young Researchers Workshop 2002, in conjunction with NET.OBJECT DAYS 2002. Erfurt, Germany, October 7-10 (2002), IESE-Report No. 053.02/E, October 21, 2002, p 20–24, Available from (Accessed October 2002)
  5. 5.
    Arnout, K.: Extracting Implicit Contracts from.NET Libraries. In: OOPSLA 2002 (17th ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications), OOPSLA 2002 Companion, Posters. Seattle USA, November 4-8, pp. 104–105. ACM, New York (2002)CrossRefGoogle Scholar
  6. 6.
    Arnout, K., Meyer, B.: Contrats cachés en .NET: Mise au jour et ajout de contrats a posteriori. LMO 2003 (Langages et Modèles à Objets). Vannes, France, February 3-5(2003)Google Scholar
  7. 7.
    Arnout, K., Meyer, B.: Spotting hidden contracts: the.NET example (submitted for publication)Google Scholar
  8. 8.
    Barnett, M., Schulte, W.: Contracts, Components, and their Runtime Verification on the.NET Platform. Microsoft Research Technical Report TR 2002-38, April 2002, Available from (Accessed April 2002)
  9. 9.
    Bezault, É.: Gobo Eiffel Lex and Gobo Eiffel Yacc. Retrieved (September 2002), from
  10. 10.
    Eiffel Software Inc. EiffelBase. Retrieved (October 2002), from
  11. 11.
    Ernst, M.D.: Dynamically Detecting Likely Program Invariants. Ph.D. dissertation, University of Washington (2000), Available from (Accessed August 2002)
  12. 12.
    Ernst, M.D., Cockrell, J., Griswold, W.G., Notkin, D.: Dynamically Discovering Likely Program Invariants to Support Program Evolution. IEEE TSE (Transactions on Software Engineering) 27(2), 1–25 (2001), Available From (Accessed August 2002)Google Scholar
  13. 13.
    Ernst, M.D., Czeisler, A., Griswold, W.G., Notkin, D.: Quickly Detecting Relevant Program Invariants. In: ICSE 2000 (International Conference on Software Engineering), Limerick, Ireland, June 4-11 (2000), Available from (Accessed August 2002)
  14. 14.
    Ernst, M.D., Griswold, W.G., Kataoka, Y., Notkin, D.: Dynamically Discovering Program Invariants Involving Collections. Technical Report, University of Washington (2000), Available from (Accessed August 2002)
  15. 15.
    Hoare, C.A.R.: Proof of Correctness of Data Representations. Acta Infomatica 1, 271–281 (1973)CrossRefGoogle Scholar
  16. 16.
    Kataoka, Y., Ernst, M.D., Griswold, W.G., Notkin, D.: Automated Support for Program Refactoring using Invariants. In: ICSM 2001 (International Conference on Software Maintenance), Florence, Italy, November 6-10 (2001), Available from Accessed (August 2002)
  17. 17.
    Kennedy, A., Syme, D.: Design and Implementation of Generics for the.NET Common Language Runtime. In: PLDI 2001 (Conference on Programming Language Design and Implementation), Snowbird, Utah, USA, June 20-22 (2001), Available from Accessed (September 2002)
  18. 18.
    Kennedy, A., Syme, D.: Generics for C# and.NET CLR (September 2002), Retrieved September 2002, from
  19. 19.
    McFarlane, K.: Design by Contract Framework for.Net (February 2002), Retrieved October 2002 from, and
  20. 20.
    Meyer, B.: Object-Oriented Software Construction, 1st edn. Prentice Hall International, Englewood Cliffs (1988)Google Scholar
  21. 21.
    Meyer, B.: Applying Design by Contract. Technical Report TR-EI-12/CO, Interactive Software Engineering Inc. (1986); Published in IEEE Computer 25(10), 40–51 (October 1992); Also published as Mandrioli, D., Meyer, B. (eds.) Design by Contract in Advances in Object- Oriented Software Engineering, Prentice Hall, Reading, pp. 1–50 (1991), Available from (Accessed April 2002)
  22. 22.
    Meyer, B.: Reusable Software: The Base Object-Oriented Component Libraries. Prentice-Hall, Englewood Cliffs (1994)Google Scholar
  23. 23.
    Meyer, B.: Object-Oriented Software Construction, 2nd edn. Prentice-Hall, Englewood Cliffs (1997)zbMATHGoogle Scholar
  24. 24.
    Meyer, B., Simon, R., Stapf, E.: Instant.NET. Prentice-Hall, Englewood Cliffs (in preparation)Google Scholar
  25. 25.
    Meyer, B.: Design by Contract. Prentice Hall, Englewood Cliffs (in preparation)Google Scholar
  26. 26.
    Meyers, S.: Effective STL. Addison-Wesley, Reading (July 2001)Google Scholar
  27. 27.
  28. 28.
  29. 29.
  30. 30.
    Microsoft Research. Current research, Programming Principles and Tools. Retrieved (November 2002), from
  31. 31.
    Mitchell, R., McKim, J.: Design by Contract, by example. Addison-Wesley, Reading (2002)Google Scholar
  32. 32.
    NET Experts. ECMA TC39 TG2 and TG3 working documents. Retrieved (September 2002), from
  33. 33.
    Nimmer, J.W., Ernst, M.D.: Invariant Inference for Static Checking: An Empirical Evaluation. In: FSE 2002 (10th International Symposium on the Foundations of Software Engineering) Proceedings of the ACM SIGSOFT, Charleston, SC, USA, November 20-22 (2002), Available from (Accessed October 2002)
  34. 34.
    Nimmer, J.W., Ernst, M.D.: Automatic generation of program specifications. In: ISSTA 2002 (International Symposium on Software Testing and Analysis), Rome, Italy, July 22-24 (2002), Available from (Accessed October 2002)
  35. 35.
    ResolveCorp. eXtensible C#© is here! Retrieved (May 2003), from
  36. 36.
    Simon, R., Stapf, E., Meyer, B.: Full Eiffel on.NET. MSDN, (July 2002), Available from (Accessed October 2002)
  37. 37.
    Software Engineering Institute. Volume II: Technical Concepts of Component-Based Software Engineering. CMU/SEI-2000-TR-008 (2000), Available from (Accessed June 2002)
  38. 38.
    Thomas, D.: The Deplorable State of Class Libraries. Journal of Object Technology (JOT), Vol.1(1) (May-June 2002), Available from (Accessed June 2002)

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Karine Arnout
    • 1
  • Bertran Meyer
    • 1
    • 2
  1. 1.Chair of Software EngineeringSwiss Federal Institute of Technology (ETH)ZurichSwitzerland
  2. 2.Eiffel SoftwareSanta BarbaraUSA

Personalised recommendations