I have compiled two cheat sheets about clean code (the ones mentioned in my post about Code Quality!).
The first covers clean code – code that is easy readable and keeps changeable. The second is about Test Driven Development. Both cheat sheets list principles, patterns, practices and smells.
You can download them now from the web site of my company – bbv Software Services AG: Clean Code, Clean TDD.
Take a look!
I’d like to read your feedback in the comments section…

(just an unreadable preview
– click on link in text above)
.NET, Agile, Test Driven Development
.NET, Architecture, Clean Code, Design, TDD, Test Driven Development, unit testing
To continue my series on Mocking Katas (see Mocking Kata – Instrument Processor for the last Kata), I’ll show you a very simple Kata that I normally use in my Test Driven Development training courses to introduce mocks (created manually or dynamically with the use of a mocking framework): the CharacterCopier.

Test Driven Development
Kata, Mocking, Test Driven Development, unit testing
We use Coding Katas in Coding Dojos to improve our programming skills. This includes skills in software design, refactoring, Test Driven Development, Mocking, tool usage and a lot of other tiny stuff.
However, I found only a few Katas, especially Katas including the need for mocks (see for example http://codingkata.org/). Most Katas are very algorithmic, which is good for learning TDD. But its bad for learning how to use mocks.
Therefore, I started to invent my own Mocking Katas. I use these in my training courses on Test Driven Development.

.NET, Test Driven Development
Kata, Mocking, Test Driven Development, unit testing
The Model View View-Model pattern gained a lot of momentum lately. It allows to reduce the code in the code behind class of a form or user control to a minimum. Therefore, unit testability is improved dramatically compared to other view patterns like MVC/MVP.
However, when I design software, I follow (amongst others) the principles of SOLID (link).
The first principle in SOLID is the Single Responsibility Prinicple (SRP) that states that “A class should have one, and only one, reason to change.” (link)
And here start my concerns about MVVM.

.NET, Architecture
.NET, Architecture, Design, Passive View Command, Patterns, Unit Test, unit testing
NMock2 is a library for assisting test driven development of .NET code by providing a dynamic mock object creation framework.
In this article, I’m going to show you the basics of the new stub feature in NMock2. Note that this feature is currently only available on the development trunk in the subversion repository at https://nmock2.svn.sourceforge.net/svnroot/nmock2/trunk. Therefore, the features discussed here may change for the next official release.
Stubs can be used in scenarios where you have to test an instance of a class (let’s call this object testee) and this testee makes calls to another object (dependency) but you simply do not care what the testee calls on the dependency because it is not relevant for your test case.
Stubs will simply ignore any calls to it and if the call has a return value then the stub provides a default value.

.NET, Software, Testing
.NET, Mocking, mocking framework, mocks, NMock2, stubs, unit testing
Andrew Kazyrevich published a post containing timing comparisons of Moq, Rhino Mocks, Isolator and NMock2.
And NMock2 – although still lacking some features – is very fast compared to the competitors. Woohoo!
I’m curious how the newly introduced features (mock classes, non-strict and recursive mocks) will change in this setup. I’ll check that out as soon as I find some time :-O
If you want to check the new features (alpha!) yourself then here is the svn URL: https://nmock2.svn.sourceforge.net/svnroot/nmock2/branches/nonstrictmocks
Happy mocking!
.NET, Announcement, Software, Testing
.NET, Isolator, mocking framework, Moq, NMock2, Rhino Mocks, unit testing
For those of you interested in TDD:
I’m speaking at the conference SET (Software Engineering Today) in Schlieren (Zurich) on Tuesday May 5th.
I’ll show the basics of the TDD cycle, benefits and pitfalls, and how you get started.
Link to SET 2009: SET 2009
Link to my session (german): TDD
Looking forward to some interesting discussions…
Methodology
Conference, SET, TDD, Test Driven Development, unit testing
The first release candidate of version 2.0 of NMock2 – a .net dynamic mocking framework – is published.
Check it out at: sourceforge.net
You can provide feedback at: NMock2 forum
Release Notes:
- virtual/abstract classes can now be mocked (with default or transparent mock style)
- Stack traces of exceptions thrown in event handlers of events fired on mocks are preserved
- Source is now on Visual Studio 2008 (target framework is still .net 2.0)
- Events of inherited interfaces can now be fired on mocks
- internal interfaces of signed assemblies can now be mocked (contribution of Matthias Weibel)
- Swallowed exceptions are rethrown in VerifyAllExpectationsHaveBeenMet
.NET, Announcement, Software
.NET, mocking framework, NMock2, unit testing
A short list of features that you can expect of NMock2 (.NET mocking framework) in one of the next releases:
- mocking of classes
- nonstrict mocks
- detectation of swallowed exceptions
- NMock2 ReSharper plugin for code completion
- state full mocks
http://sourceforge.net/projects/nmock2

.NET, Software
.NET, mocking framework, NMock2, unit testing