MSDN Magazine: Cutting Edge - Give Your Classes a Software Contract. MSDN Magazine: Cutting Edge - Code Contracts Settings in Visual Studio 2010. Last month I introduced software contracts as they’re implemented in the Microsoft .NET Framework 4.
Known as Code Contracts, software contracts allow you to express formal conditions your code should fulfill to work properly. Code Contracts cause your code to throw an exception if a method doesn’t receive data as expected or if it produces data not following expected postconditions. For an overview of preconditions and postconditions, you might want to check out my article in last month’s issue (msdn.microsoft.com/magazine/gg983479). Code Contracts are part of the .NET Framework 4, but also rely on a few facilities in Visual Studio 2010, such as runtime tools, integration with MSBuild and a property page in the Project Properties box.
Contracts. Code Contracts provide a language-agnostic way to express coding assumptions in .NET programs.
The contracts take the form of preconditions, postconditions, and object invariants. Contracts act as checked documentation of your external and internal APIs. The contracts are used to improve testing via runtime checking, enable static contract verification, and documentation generation. Code Contracts Part 1 – Introduction.
Series Redux I discovered Microsoft Code Contracts several years ago and fell in love with the idea.
Code Contracts have helped me to write better software since 2008 so I’d like to share them with you. I did an extensive blog series on this subject several years ago which was quite popular. What is SCRUM? Contents Introduction SCRUM is a loose set of guidelines that govern the development process of a product, from its design stages to its completion.
It aims to cure some common failures of the typical development process, such as: Chaos due to changing requirements - the real or perceived requirements of a project usually change drastically from the time the product is designed to when it is released. Under most product development methods, all design is done at the beginning of the project, and then no changes are allowed for or made when the requirements change. Scrum Process for Software Development using Microsoft Visual Studio Scrum 1.0 Process Template. Picture 1: Pictorial representation of Waterfall, Iterative and Scrum Software Development methodologies.
The waterfall approach is highly risky, often more costly and generally less efficient than more Agile approaches. It requires the creation of up-front documentation before any real business value is created. i.e. You don’t realize any value until the end of the project. This is confounded by the fact that product development is started downstream, or much later in the project’s expected timeframe. This has the obvious disadvantage of delaying the point at which business value can be realized. Remember the 80-20 rule, 80% of a product’s value comes from 20% of its features.
Introducing BDD « DanNorth.net. History: This article first appeared in Better Software magazine in March 2006.
It has been translated into Japanese by Yukei Wachi, Korean by HongJoo Lee, Italian by Arialdo Martini and French by Philippe Poumaroux and most recently into Spanish by Oscar Zárate, Turkish by Selim Öber and Russian. I had a problem. While using and teaching agile practices like test-driven development (TDD) on projects in different environments, I kept coming across the same confusion and misunderstandings. Mocks Aren't Stubs.
The term 'Mock Objects' has become a popular one to describe special case objects that mimic real objects for testing.
Most language environments now have frameworks that make it easy to create mock objects. What's often not realized, however, is that mock objects are but one form of special case test object, one that enables a different style of testing. In this article I'll explain how mock objects work, how they encourage testing based on behavior verification, and how the community around them uses them to develop a different style of testing. I first came across the term "mock object" a few years ago in the Extreme Programming (XP) community. Since then I've run into mock objects more and more. TDD : Introduction to Moq.
In this post, I provide an introduction to Moq which is the newest of the Mock Object Frameworks.
Moq is promoted by its creators as easier to learn and use than other Mock Object Frameworks such as Rhino Mocks and TypeMock Isolator. Moq takes advantage of recent VB.NET and C# language features such as lambdas and generics. When creating mock objects with Moq, you use lambda expressions to represent the methods and properties that you want to mock. The emphasis on lambdas enables Moq to provide a very clean syntax for representing expectations, parameter constraints, and return values.
Moq - The simplest mocking library for .NET and Silverlight. Adapting to Inversion of Control and Dependency Injection. You might have come across the phrases IoC, Dependency Injection, Mocking among others, these are commonly used when talking about “Inversion Of Control” which is the full meaning of the abbreviation IoC.
So what is this “IoC” that everyone is talking about? Inversion of control is a principle in Software Engineering, let’s just take a look at the Wikipedia definition of this In practice, Inversion of Control is a style of software construction where reusable generic code controls the execution of problem-specific code. It carries the strong connotation that the reusable code and the problem-specific code are developed independently, which often results in a single integrated application. Rather than explaining the text below, let me show an example of an application that does not follow this principle, but will when we’re done here! The order form is very simple and looks like this:
Balsamiq. Getting started with a Mocking Framework. In previous articles we’ve looked at how to increase code quality by either introducing test drive development for new features or using inversion of control.
There are of course many other aspects that come into play when you want to reach high-quality code and this article is going to introduce you to mocking that will help you along the way. You might have come across the word “mock” before, when for instance a UI designer for a Windows Phone application on your team puts together a picture of how the application might look when it is finished: Where do the buttons go? What text might be displayed when the button is pressed?