Welcome!

.NET Authors: Jayaram Krishnaswamy, RealWire News Distribution, Liz McMillan, Steve Mordue, PR.com Newswire

Related Topics: .NET, Cloud Expo

.NET: Blog Feed Post

Code Contracts in .NET Help Distributed Software Development Teams

The notion of design-by-contract programming has been around for quite a while

Microsoft’s Research in Software Engineering (RiSE) team is on to something.  Luckily, for developers around the world, they have released it to the public.  I’m talking about Code Contracts in Microsoft .NET.  Code Contracts are very useful under any circumstance; however, they are particularly useful in helping distributed software development teams increase team efficiency, improve product quality, and mitigate against risks associated with team dispersion.

The notion of design-by-contract programming has been around for quite a while.  In fact, Bertrand Meyer (founder of Eiffel) was writing about the trade marked Design by Contract approach as early as 1992.  Design-by-contract programming, according to Meyer, is a fundamental but often overlooked tenant of object oriented programming.  The addition of design-by-contract programming into the .NET framework provides a mechanism by which all .NET languages can benefit from increased reliability.

Code

Distributed software development teams will find Code Contracts particularly useful.  Distributed teams deal with the same issues as non-distributed teams.  In addition; however, the distributed team must manage through issues related to communication, location, and sometimes culture.  Development assignments, in the distributed team scenario, are often partitioned along horizontal or vertical boundaries.  Parallel implementation typically requires up-front design and agreement upon the application interfaces.  This allows the team members, or sub-teams, to code independently of one another.  This approach requires a fair amount of blind trust that the various parts of the application will function as designed.  Code Contracts eliminate the need for blind trust.

Consumers of internal and external APIs that include Code Contracts will know that all of the contract-defined pre- and post-conditions have been met.  This will not only engender trust in current development efforts, it will support the promotion of code/object/service re-use during future development efforts.

Additionally, code contracts:

  • Make the product stabilization process more efficient by weeding out potential run-time errors at compile time.  In a distributed team, this reduces the probability that one group wastes time unknowingly debugging errors introduced by a remote group.  Additionally, it helps reduce the vicious cycle of compile-deploy-test-debug-compile-deploy-test; which can be very time consuming and, thus, expensive.
  • Enhance the continuous integration process by leveraging contracts to generate more meaningful unit tests.  Improved testing and the guarantee that preconditions and postconditions have been met combine to produce more robust, higher quality software.
  • Empower the software architects with additional tools that allow them to programmatically constrain developers.  This is quite useful when managing offshore teams.  In this scenario, the design-by-contract approach can help reduce documentation-derived management overhead and increase quality and reliability at the same time.

The announcement of .NET Code Contracts was a pleasant surprise, as it represents a maturity milestone for the Microsoft .NET platform.  I look forward to adopting it because it gives my software architects another tool that can be leveraged to enforce the architectural fidelity of our products.

Code Contracts can be downloaded for use with Visual Studio 2008 Team System.  The Code Contracts library will be included as a native namespace in the .NET Frameworks 4.0 release.  Mike Barnett provides a great Code Contract tutorial on channel9.msdn.com.

Photo credit David Reeves, El Fotopakismo.

More Stories By Walter Pinson

Walter Pinson is the Chief Software Architect at SMBLive; whose IAmFound social marketing platform helps SMBs (small and medium-sized businesses) get discovered online and generate inbound sales leads. In his role as CSA, Walter manages a globally distributed product development group and has SaaS products deployed at major telecommunications channel partners in the US, UK, Switzerland, Canada, and Mexico. Additionally, Walter is a co-founder and principal of Pinson3 Systems; a boutique software engineering concern serving the intelligence and defense sectors with solutions ranging from enterprise web-based multi-modal biometric analysis systems to information warfare training systems. Prior to his role at SMBLive and founding Pinson3 Systems, Walter was a Senior Strategy Consultant with Microsoft focused on SaaS, SOA, and .NET adoption in the telecommunications sector. Walter has published articles for Cloud Computing Journal, is a member of ACM and IEEE, and currently has one patent pending. He holds a bachelor's degree in computer science from The Volgenau School of Information Technology and Engineering at George Mason University, where he focused on distributed and parallel computing. Walter is currently working on his MBA at the GMU School of Management.