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

Moq asserts - .Verify() vs .VerifyAll() and how VerifyAll can seriously hamper test readability

Hi all,

I've been looking at some tests we've been writing here today, and I think I've spotted a bit of an anti-pattern that I'd like to quickly draw out. In my experience, when I pick up existing unit tests there are three things I look at - what code is being exercised, do the tests pass when I run them, and crucially what is being asserted. Your assert is the one line of code that justifies te existene of the entire test. Getting this wrong can lead to a situation where even if you have 100% code coverage, you have no assurance that your code actually does anything useful at all.

More...


Permalink | Comments (0)

C# .net Exception Handling Best Practice - As Easy as 1, 2, 3?

Hi all,

In my day job, I'm currently running a little project to establish some best practices that we can both adopt going forward, and somehow start applying to our existing legacy systems.

I know there a million people out there with their own ideas of "best practice", and it's a shame that these things don't seem to be portable between different development teams, but I guess as long as we can't agree on the whole tabs-vs-spaces thing for indenting code, I'm not going to hold my breath waiting.  Instead, here's where we are at the moment - our Exception Handling holy trinity.

More...


Categories: Architecture
Permalink | Comments (0)

Fhem DotNet - Let's Try That Again

Hi all,

I have a confession to make - my initial efforts to create a .Net FHEM front end have become mired in the deepest depths of geek porn - I've spent the last 2 months building the coolest (but mostly pointless) Fhem <-> POCO (Plain Ol' Code Object) mapper à la Fluent nHibernate, using all sorts of stuff I'd not really dug into before, such as generics, consuming lambda expressions, Moq-based isolation testing, fluent APIs, etc.

But so far, as much fun as it's been, I've got squat to show for it.  I'm as annoyed as anyone, I've been boasting about having this nifty central heating control thing, and when anyone asks about it up comes a Putty console, and suddenly it all seems just lame.  Plus it's pretty clear that at this rate, as soon as I have anything useful out the door, I'll be basking in a freak British summer heatwave, with central heating concerns a distant memory.

I've decided the way forward is to start with a clean slate and what I hope to be a cleaner methodology.

More...


Permalink | Comments (0)

Spring.Net - Unable to locate Spring NamespaceHandler for XML schema namespace

Hi all,

I'm just putting this out in the wild because I've just spent a good few hours banging my head against a wall!  If you're using Spring.net for dependency injection, and you're getting an error similar to the following:

"Unable to locate Spring NamespaceHandler for XML schema namespace []"

Note the empty brackets - make sure you've got a correct namespace on your Spring.Net configuration!  Just to recap, your web.config / app.config should have the following custom configuration section, specifically including the bit in bold.  This namespace appears to be hardcoded into the Spring.Core assembly source as a trigger for "good" behaviour:

 

  <spring>
    <context>
      <resource uri="config://spring/objects" />
    </context>
    <objects xmlns="http://www.springframework.net">
    </objects>
  </spring>

 

Take care all,

Russ


Categories: Sneaky Bug Fixes
Permalink | Comments (0)

Shuffling content around

Hi all,

Just a quick post to advise that I'm going to start making more use of our FHEMDotNet space over on Google Code, which to begin with means moving reference-type blog content over to the wiki at http://code.google.com/p/fhemdotnet/wiki/Index, and making this blog more about the development process.  FHEM-specific content will be moved over to the FHEMWiki site, where it really belongs.

On the subject of the "development process", right now I've got five priorities,pretty much in the following order:

 

  1. Test-driven development - I want to adopt an extreme TDD approach on this project, to contrast with a much more relaxed testing strategy I use in my day job.
  2. MVC - To aid in making as much code testable as possible, this will be my first web project written in MVC
  3. Agile Methodology - I'm going to be adopting an agile methodology, so the aim is to release early and release often,
  4. Personal Use of the Software - I actually have a full FHT installation running my home heating, so obviously this software is catering for my own needs first!
  5. My First Open-Source Contribution - This will be my first open source project, so of course this will be the first time I offer my code up to public scrutiny.

 

The key features in the first few releases of the software have been confirmed, so I'm currently beavering away readying the first release to give minimal device visibility and configuration.  More news as and when it's available!


Categories: Blogging & Social
Permalink | Comments (0)

Mocking Frameworks - Rhino Mocks vs Moq

This discussion has been had many times, by people far more qualified to comment than myself, but nonetheless, here're my thoughts.

The Story So Far...

I've been programming with unit tests for probably a year now, and as I get opportunities to write code from scratch (I do a huge amount of bug fixes and configuration work it seems!) I'm finding I can get more and more value from them.

About 2 months ago I started playing with the Rhino Mocks mocking framework, so that I can test my code without dependencies slowing down my tests or making them brittle, and I was totally blown away at how much easier my tests became.  The ability to mock objects without having to actually create the mock, and the ease with which the mock objects can be configured, is pretty astonishing when you first see it!

However last week a colleague of mine turns out to have been playing with another well known mocking framework, Moq, so I figured it would be worth looking at the two side-by-side before I pick one for use in this project.

More...


Permalink | Comments (0)

.Net FHEM Front-End - Ingredients

Now that I'm about to start developing the front end, as well as potential features, let's talk a little about the "ingredients" that I'm going to need.

In this post I'm going to talk about the development and integration platforms (.Net 3.5 and Hudson respectively), a little about development methodology, the tools I'll be using for testing (NUnit, Rhino Mocks / Moq), and a few other bits and pieces (Log4Net, NAnt, Fluent NHibernate, Subsonic, etc)

More...


Categories: FHEM
Permalink | Comments (0)

.Net FHEM Front-End - Feature Brainstorm

Hi all,

I'm at the point where I feel my FHEM installation is sound - it works, it's logging the data I need it to log, I can remote into it and it looks like it's behaving, all in all it's a solid, friendly enough piece of software.  

So I want to shift focus to my planned .Net front end, and I'm sitting on the train each day, and on my lunch break each day, brainstorming - what can it do for me?  The following are my own thoughts, I'd love to get some more suggestions from anyone else with this kind of setup.

More...


Categories: FHEM
Permalink | Comments (0)

Configuring FHEM To Run as a Windows Service

So that FHEM is running constantly, even when noone is logged into my server, I'm going to try to get it running as a Windows Service, which I can configure to run as a particular user as soon as the server boots.

I'm going to base the some of the following on the excellent tutorial to install uTorrent as a service - http://www.deciphered.net/blog/2007/04/25/howto_install_utorrent_service_windows_home_server_whs_ctp, so many thanks to the original author.

More...


Permalink | Comments (0)

Troubleshooting Remote Access to an FHEM Server

Hi all,

A quick one tonight because I've just spent a good half an hour scratching my head over it!

If you're running an FHEM server, and you'd like to be able to access it via Telnet from a remote box, here are four quick steps you can take to troubleshoot any issues you're having.

More...


Permalink | Comments (0)