Coding and Dismantling Stuff

Don't thank me, it's what I do.

About the author

Russell is a .Net developer based in Lancashire in the UK.  His day job is as a C# developer for the UK's largest online white-goods retailer, DRL Limited.

His weekend job entails alternately demolishing and constructing various bits of his home, much to the distress of his fiance Kelly, 3-year-old daughter Amelie, and menagerie of pets.

TextBox

  1. Fix dodgy keywords Google is scraping from my blog
  2. Complete migration of NHaml from Google Code to GitHub
  3. ReTelnet Mock Telnet Server à la Jetty
  4. Learn to use Git
  5. Complete beta release FHEMDotNet
  6. Publish FHEMDotNet on Google Code
  7. Learn NancyFX library
  8. Pull RussPAll/NHaml into NHaml/NHaml
  9. Open Source Blackberry Twitter app
  10. Other stuff

Living With Tests - Some Gems Courtesy of Toughtworks' Dan Moore

A few weeks ago I was fortunate to watch a presentation given by Dan Moore, at the Thoughtworks office over in Manchester. The guy giving the talk was my sort of geek - I got the impression that he wasn't a lover of giving presentaitons, but he did love the tech enough that he just had to share it. I've been there! There were a few good little nuggets I took from the talk, that looking on my to-do list I really wanted to blog about, for example page objects, the "mysery guest", making test fail elegantly, etc, so without furher ado, here we go.

More...


Permalink | Comments (0)

Unit Testing Good Patterns #3 - Know Your Moq Argument Matchers

Having spent some time working with Moq, I've found that understanding the argument matchers bundled up in the "It" class is pretty useful stuff. The "It" class is a static class with a few methods on it that are used to tell Moq about the arguments it should expect to receive from your code.

This post is going to be a fairly in depth run through of the core two It methods - It.IsAny<T> and It.Is<T>(a => a....) - followed by a quick skim through the less used It.IsInRange and It.IsRegex methods.

More...


Permalink | Comments (0)

NHibernate Error "Object references an unsaved transient instance" - Fixed!

Hi all,

Just a quick post to share some learnings I've had around a good ol' NHibernate "Object references an unsaved transient instance" error message. In essence, this message is telling you that you're trying to save an object which has a reference to another unsaved object, and NHibernate for one reason or another is unable to work out which object to save first so that it can work out the ID to apply to the other end of the reference. What went wrong and how did I fix it?

More...


Categories: Sneaky Bug Fixes
Permalink | Comments (0)

Cooking with .Net Lambdas Part 1 - Covering Up Them Code Smells

.Net Lambas are awesome. I know a few folks who maybe don't share the sentiment, but to me they thoroughly kick ass. I just need to look at projects such as Fluent NHIbernate, or Moq, and it's pretty clear that Lambas have been one of the most rewarding language extensions ever, period. But I'm going to hazard a guess that if you're a C# developer and you're reading this, you've used lambas many times in things like a "List<T>.Where(...)", but you haven't got a clue what the heck that "Func<T, string>" stuff is all about.

I'm not going to give you a nitty-gritty low level explanation - there are plenty of those already knocking around, so instead I'm going to just going to give a nice step-by-step example.

More...


Categories: Architecture
Permalink | Comments (0)

Debugging Good Patterns #1 - ToString() Is Your Friend!

Here's a nice punchy one - so short a post, it might even warrant now't more than a tweet, but the blog's been a bit barren of late so here I am.

When you're debugging code (of course that's a rare thing now I'm living the TDD dream ;), if you frequently find yourself digging around in the Visual Studio Watch or Quickwatch windows investigating properties on objects, sub-objects, sub-sub objects, etc, then here's a good 'un. The quickwatch window becomes massively more useful with one simple addition - override the ToString() method on every class in your system so that it summarises the key properties, without you having to expand that object and hunt down those properties.

More...


Categories: Architecture
Permalink | Comments (0)

Testers Aren't Devs! - Build Product-Specific Test APIs, and No Stinkin' Selenium IDE

As some of you may know, for some months now I've been digging into automated testing. Unit testing, Selenium testing, coverage tools, specification testing, I'm lovin' it. But the tools aside, I have come across one problem which I've both seen first hand and heard plenty about second hand. Testers are not developers, nor are developers testers! You can't sit your testers in front of a blank visual studio solution and expect them to fly, and on the other hand your devs don't want to test, they want to be off building cool stuff! So what's the solution?

More...


Permalink | Comments (0)

Commuter Coding - Focusing Through Frequent Interruptions

In possibly the shortest blog post known to man, I'm going to share a problem and a possible solution. I'm a rail commuter, so during the week my open-source dev life is broken into three chunks.  I get a 30 minute chunk on the way into work, a 30 minute chunk on the way home, and then an hour or so in the evening. But working in these little fragments is not great for productivity! I really struggle to keep focused, to maintain a flow and keep "in the zone".

More...


Categories: Blogging & Social
Permalink | Comments (0)

Creating a Simple Build Pipeline with Jenkins/Hudson and NAnt

Hi all,

Anyone who's following the FhemDotNet twitter account (at the time of writing that will be... me) may have noticed a flurry of tweets the last few days.  I've been experimenting with ways to improve the build feedback and performance I'm getting from Jenkins, using multiple build jobs and the "Copy Build Artifacts" plugin. I've now got the ability to check in a code change, Jenkins will run a build job, and then fire off two test jobs simultaneously (unit tests and integration tests), tweeting passes and fails for each of the three jobs, and giving me quicker and more detailed feedback along the way.

It took a fair few stabs to get it right, so best I share my learnings.

More...


Permalink | Comments (3)

Should Unit Tests Live in Production Projects?

As I'm doing more and more work with unit tests, I'm beginning to have some pretty unconventional ideas around the way we organise our test code and production code. My latest thoughts? I'm seriously considering putting all of my unit tests in my production projects and wrapping them in compiler conditionals so they're not included in release assemblies.

These aren't the worst suggestions I've heard - some people are even advocating including your unit tests in your production classes, just tagged at the bottom, I'm not sure I'm quite that far gone, but I'm getting there.

More...


Permalink | Comments (4)