On Wednesday, February 17, 2010, I gave a 90 minute presentation to the Minnesota Visual Studio User Group, on the use of Microsoft Code Contracts to improve software quality. Approximately 17 programmers attended. I used several Visual Studio solutions and several PowerPoint presentations. All of the materials can be downloaded from my download section. In addition, I have summarized several of the questions that were asked by the participants. For each question, I have included the answer that I gave them, as well as additional thoughts I had after further reflection. If any of you are giving presentations on the topic of code contracts, feel free to use any of the slides or sample code.
You have demonstrated how to use a precondition. But I don’t see why I shouldn’t simply use my traditional “if(x) then (do y)” statement to validate arguments.
Answer I gave: (more…)
Tonight, February 11, 2010, Justin Chase spoke about the MetaSharp project available on CodePlex.
MetaSharp is a developer tool designed to assist in the creation of Programming Languages. Using MetaSharp’s fully extensible, pipelined transformation engine you can easily create your own Domain Specific Languages or General Purpose programming languages.
He gave a brief overview of different categories of domain specific languages: fluent, parasitic, internal, external.
I don’t know much about any of these things. So I was overwhelmed with new ideas and technologies. I was very impressed with the amount of work that Justin has done on this open source project. It sounds like he’s taken on some very ambitious work. Here are some of the crazy technologies that he has learned and is applying
Oslo, MGrammar, abstract syntax trees.
MEF Application requirements change frequently and software is constantly evolving. As a result, such applications often become monolithic making it difficult to add new functionality. The Managed Extensibility Framework (MEF) is a new library in .NET Framework 4.0 that addresses this problem by simplifying the design of extensible applications and components.
He mentioned that he was particularly inspired by the parasitic domain specific language ometa.
He also mentioned that the service locator pattern had been useful to him.
Jason Bock demonstrated how to use Pex to identify defects in code. Pex can only investigate public methods. Integrates well with Visual Studio, enabling testing of a single method with a simple right-click.
You can optionally instrument framework classes if you wanted to investigate paths within the framework. But that can get pretty hairy X. can only analyze managed code.
Using CCI, he built AutoPex to enable Pex to run and focus specifically on changes from one build to another.
Jason also mentioned a number of the underlying technologies that are used in Pex, such as Z3 and Moles.
Jason said the latest version of Pex does not work with Visual Studio 2010 release candidate.
Twin Cities Code Camp 8
Saturday, April 10, 2010 from 8:00 AM – 5:00 PM (CT)
If you use comprehensive automated testing and code contracts, you may have noticed something: sometimes, when a contract fails, it causes large numbers of tests to fail. This can seem overwhelming at first. And if you are accustomed to the ideal of unit test isolation, it may even seem to be a bad smell. This ripple effect of a failure in one component is not unique to the use of contracts. And ways to handle it are described well in several places. such as (more…)
Matthias Jauernig has begun a series of articles at http://www.minddriven.de/?p=608 that compares and contrasts TDD and DbC in an effort to help us identify how to use both methods together. If you are interested in this topic, I highly recommend it. It methodically examines some relationships between these two practices.
Here are some of my thoughts on the synergy: (more…)