Close
  • Latest News
  • Artificial Intelligence
  • Video
  • Big Data and Analytics
  • Cloud
  • Networking
  • Cybersecurity
  • Applications
  • IT Management
  • Storage
  • Sponsored
  • Mobile
  • Small Business
  • Development
  • Database
  • Servers
  • Android
  • Apple
  • Innovation
  • Blogs
  • PC Hardware
  • Reviews
  • Search Engines
  • Virtualization
Read Down
Sign in
Close
Welcome!Log into your account
Forgot your password?
Read Down
Password recovery
Recover your password
Close
Search
Logo
Subscribe
Logo
  • Latest News
  • Artificial Intelligence
  • Video
  • Big Data and Analytics
  • Cloud
  • Networking
  • Cybersecurity
  • Applications
  • IT Management
  • Storage
  • Sponsored
  • Mobile
  • Small Business
  • Development
  • Database
  • Servers
  • Android
  • Apple
  • Innovation
  • Blogs
  • PC Hardware
  • Reviews
  • Search Engines
  • Virtualization
More
    Subscribe
    Home Applications
    • Applications
    • Development
    • IT Management
    • Networking

    Microsoft Delivers Code Contracts for .Net

    Written by

    Darryl K. Taft
    Published February 24, 2009
    Share
    Facebook
    Twitter
    Linkedin

      eWEEK content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

      Microsoft has implemented the design-by-contract approach to software development for .Net developers.

      In a solution called Code Contracts for .Net, which came out of Microsoft Research, Microsoft is providing a design-by-contract mechanism for .Net programmers.

      Design by Contract (DbC) is an approach to designing that proposes that software designers should define formal, precise and verifiable interface specifications for software components based upon the theory of abstract data types and the conceptual metaphor of a business contract. In other words, the basic idea is that software components can define “contracts” about their behavior, inputs, state change and other things. The term was coined by Bertrand Meyer, creator of the Eiffel programming language.

      In a blog post, Microsoft Senior Vice President, Developer Division, S. Somasegar said Microsoft’s Dev Labs released Code Contracts for .Net to enable programmers “to provide method preconditions and postconditions that enrich existing APIs with information that is not expressible in the type systems of .Net languages. Additionally, contracts specify object invariants, which define what allowable states an instance of a class may be in (i.e. its internal consistency).”

      Somasegar also said:

      ““The contracts are used for runtime checking, static verification and documentation generation. Contracts also allow automatic documentation checking and improved testing. Code Contracts for .Net currently consists of three components: the static library methods used for expressing the contracts, a binary rewriter and a static checker.”“

      Moreover, Somasegar said developers also can use Code Contracts directly in Visual Studio. Indeed, “Installing the Code Contracts MSI enables the ‘Code Contracts’ tab in project properties where you can set your preferences for Code Contracts use,” Somasegar said. “For configurations where the runtime checking is not performed, the library methods are compiled away (via conditional compilation attributes on their definitions — a very neat feature of .Net!) so that your code pays no performance penalty at all for contracts that you do not want executed.”

      In a conversation about the new DbC support for .Net, a prominent Java developer in the industry told eWEEK, “It would be nice to have this as part of a modern, mainstream environment.”

      Eric Newcomer, an independent consultant and former chief technology officer at Iona (now part of Progress Software), said of Microsoft’s move, “It looks like they are extending interfaces for pre and post conditions, to extend the agreement level between client and server programs — or service requester and provider more correctly, I suppose. The interface by itself defines only a limited agreement, adding pre and post conditions, and further documentation to a ‘contract’ extends what it is possible to check on.”

      Further, Newcomer, who also is a Microsoft architecture Most Valuable Professional (MVP), said:

      ““Customers always have the general issue of needing to agree on more than what can be put into an interface. You have policies and service level agreements, but you also have ownership issues — i.e. who owns the data, who has the responsibility for changing the design etc., and typically you have to write down a lot of these formal agreements when doing SOA [Service Oriented Architecture] stuff — sometimes mentioned as the governance aspect I suppose — and by extending what you can code and test for, you extend what can be put into the software, and at the same time decrease what you have to rely on associated documentation for.” “

      Darryl K. Taft
      Darryl K. Taft
      Darryl K. Taft covers the development tools and developer-related issues beat from his office in Baltimore. He has more than 10 years of experience in the business and is always looking for the next scoop. Taft is a member of the Association for Computing Machinery (ACM) and was named 'one of the most active middleware reporters in the world' by The Middleware Co. He also has his own card in the 'Who's Who in Enterprise Java' deck.

      Get the Free Newsletter!

      Subscribe to Daily Tech Insider for top news, trends & analysis

      Get the Free Newsletter!

      Subscribe to Daily Tech Insider for top news, trends & analysis

      MOST POPULAR ARTICLES

      Artificial Intelligence

      9 Best AI 3D Generators You Need...

      Sam Rinko - June 25, 2024 0
      AI 3D Generators are powerful tools for many different industries. Discover the best AI 3D Generators, and learn which is best for your specific use case.
      Read more
      Cloud

      RingCentral Expands Its Collaboration Platform

      Zeus Kerravala - November 22, 2023 0
      RingCentral adds AI-enabled contact center and hybrid event products to its suite of collaboration services.
      Read more
      Artificial Intelligence

      8 Best AI Data Analytics Software &...

      Aminu Abdullahi - January 18, 2024 0
      Learn the top AI data analytics software to use. Compare AI data analytics solutions & features to make the best choice for your business.
      Read more
      Latest News

      Zeus Kerravala on Networking: Multicloud, 5G, and...

      James Maguire - December 16, 2022 0
      I spoke with Zeus Kerravala, industry analyst at ZK Research, about the rapid changes in enterprise networking, as tech advances and digital transformation prompt...
      Read more
      Video

      Datadog President Amit Agarwal on Trends in...

      James Maguire - November 11, 2022 0
      I spoke with Amit Agarwal, President of Datadog, about infrastructure observability, from current trends to key challenges to the future of this rapidly growing...
      Read more
      Logo

      eWeek has the latest technology news and analysis, buying guides, and product reviews for IT professionals and technology buyers. The site’s focus is on innovative solutions and covering in-depth technical content. eWeek stays on the cutting edge of technology news and IT trends through interviews and expert analysis. Gain insight from top innovators and thought leaders in the fields of IT, business, enterprise software, startups, and more.

      Facebook
      Linkedin
      RSS
      Twitter
      Youtube

      Advertisers

      Advertise with TechnologyAdvice on eWeek and our other IT-focused platforms.

      Advertise with Us

      Menu

      • About eWeek
      • Subscribe to our Newsletter
      • Latest News

      Our Brands

      • Privacy Policy
      • Terms
      • About
      • Contact
      • Advertise
      • Sitemap
      • California – Do Not Sell My Information

      Property of TechnologyAdvice.
      © 2024 TechnologyAdvice. All Rights Reserved

      Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.