View Integration Tests with Spring 2.5

Over the past few months I’ve spent a fair amount of time with the Spring 2.5 annotation-based integration test support and have by and large been impressed. The combination of the @ContextConfiguration and @Transactional annotations with Autowiring makes most integration tests easy to write and read. Add in the support for caching of an ApplicationContext once it’s been loaded once and the benefit to cost ratio looks much rosier for most integration tests.

However, I recently tried to write a regression test against the output of a view (in this case a Velocity template, but it’s a general issue) and came across an exception:

Continue reading

Mockito makes you think

Recently I’ve spent a fair bit of time moving some older unit tests from JUnit3 with JMock1 to JUnit4 with Mockito. It’s been a real pleasure to see how much more clearly the tests read afterwards and while the benefits would not have been so marked if I’d been moving the test from Easymock, I’m clear there would have been a noticable improvement.

Mockito has many helpful little touches. The @Mock annotation not only reduces boilerplate, but also clearly identifies mocks in member variable definitions. The well thought out stack traces present failure information as clearly as possible. However, where it really stands out from other mocking frameworks is that it makes you think more clearly about what it is you’re actually testing and then express that intent in the test.

Continue reading

Shockingly Mario Kart Wii is not an accurate driving sim

Some people seem to believe that Mario Kart’s Wii incarnation has seen it descend from it’s lofty perch of arch technical racing game. There are plenty of good technical racing games available, such as Forza and Gran Turismo, where winning a race relies almost exclusively on skill. It’s not a new, or bad phenomenon that that’s not true of Mario Kart Wii.

The genius of Mario Kart has always been that it understands that actually, for a game to be most fun with a group of friends of varying abilities, it’s important that someone who’s barely competent can sometimes, with a big stroke of luck beat someone much more skilled. Mario Kart Wii keeps this and still makes sure, unlike many of it’s imitators, that over a number of races, the more skilled player will on average come out on top.

Some better design decisions could have been made. The perfect number for a game of Mario Kart is probably 6-8 and with 12 players there are just too many players with a really powerful present at any one time. Frequently seeing two players with a star active simultaneously feels wrong. This problem is further exacerbated by the new presents, which with the exception of the rather glorious personal lightning cloud, tend towards the over-powering, while adding little new in the way of tactical thought, but none of these things break the game.

Some of the later tracks remain tight and require technical skill; the new Rainbow Road is wonderfully finely balanced and even on some of the apparently more straight-forward trackes, as eurogamer point out, it’s allabout finding the next mini-boost, with a lot of room still available for eeking out extra fractions of a second.

Remarkably the online play really works well. The needless complication of friend codes and the fact you don’t have visibility of friends during single player are unfortunate, but the general match-making is simple and smooth and the racing is in general pleasantly free of lag.

The DS version, which I’ve been playing almost continously for close to 2 years, has rightly been held up as a return to form after the awful Double Dash and Mario Kart Wii, while perhaps taking as many steps back as forward, is starting from such an advanced position that it’s still a remarkably joyous game.

Most people prefer Safety to Efficiency

In proof either of my amazing prescience, or total lack of original insight, almost immediately after I’d made my previous post I attended an excellent talk by Giles Colborne at QCon on simlicity in user interfaces where he expressed the difference between the likes of me and  the vast majority, who don’t appreciate that Vim is the best way to edit text, by saying that most people are more interested in getting from A to B without crashing, than in doing so efficiently.  Not sure that he realised how literal some of us are in our favouring the risk of crashing.

I’ll shut up about it now before insurance companies start adding Vim usage as a risk to add to your premium.

Premature Optimisation Strikes Again

I was always a software developer, it just took me till I was 18 to realise it.

I had always strived for that peculiar blend of abstract beauty and optimisation of tasks that make software geeks peculiarly excited.  As a teenager, I used to attempt to balance out, symmetrically, the movements from one half of my body with the other.  The process of designing and writing software, as well as a way of paying the bills, is a way of getting that kind of need out of my system and allowing myself to be a little less odd.

However, I still can’t just walk from one place to another without trying to optimise the route, by shaving corners off wherever possible, in an attempt to minimise the distance.  When crossing a road, the passage of cars down the road, which might run me over if I try and take the most direct route and hence stay on the road longer, just adds some more variables into the equation, making it a little more interesting.

However, software development has taught us that optimising at a low level, if you don’t know you need to, can be costly.  Catching a train, instead of walking,  is normally worth  doing without any additional information.   Running for a train is only really worthwhile if you know that otherwise you would miss it.

On Sunday I tried to optimise my route to a parking space at the supermarket by nipping through a gap next to a big concrete pillar.  The pillar now has a rather fetching bit of red paint which used to be attatched to my car.

Did we need another one?

Well no, obviously not, but my pretence at a lack of vanity could only last so long, so this is my ‘blog to help bolster those stats about the average ‘blog having less than one reader. I’ve wanted to tell my half reader about how disproportionately upset I was when Ted Wragg died, about how disproportionately excited I am about yet another mocking framework, or how simply joyful Super Mario Galaxy is; so this is now the place for such ramblings.