Nov 24, 2011

Parameters: You’re Doing It Wrong!

Having parameters for a method is perfectly fine however like anything, they can be used for evil. So let me give you a tip: If your code looks anything like this method signature (and I kid you not, this is a real method) then YOU”RE DOING IT WRONG!

    DateTime,DateTime,DateTime ,DateTime,Boolean,Boolean,Boolean,Int32,Int32,Int32,Int32,Int32,Int32 ,Boolean,
    Boolean,Boolean,Boolean,Boolean,Single,Boolean,Boolean ,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,
    Boolean,Boolean ,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,

Please, for the love of all things good, turn off your computer right now. Pack it in a box.  Put the box in a locked safe.  Put the safe in a bunker under a mountain. Seal the bunker using 40 foot thick concrete and collapse the entrance.  Place a minefield and barbed wire around the bunker, and never EVER WRITE A LINE OF CODE AGAIN!

Nov 23, 2011

Ready Player One

imageI wouldn’t normally mention a fiction book here as your taste for books is likely to be different to mine, however in this case I’ll make an exception.  I’ve just finished reading “Ready Player One” and enjoyed it so much I read it in just 2 days whilst catching planes and trains and by skipping on sleep.  It was such a good read I simply couldn’t put it down!  I loved it!

Why so? Because it’s a near future, sci-fi book with a big virtual reality/gaming element that I think most geeks will love, especially those who know what an easter-egg is and those with a good knowledge of 80’s geek-, gaming- and/or pop-culture.  Plus it’s got some seriously fun puzzles to try and solve before the reveal happens.

This book was also Amazon’s book of the month for August 2011, and deservedly so.  Here’s the Amazon review quoted verbatim:

Amazon Best Books of the Month, August 2011: Ready Player One takes place in the not-so-distant future--the world has turned into a very bleak place, but luckily there is OASIS, a virtual reality world that is a vast online utopia. People can plug into OASIS to play, go to school, earn money, and even meet other people (or at least they can meet their avatars), and for protagonist Wade Watts it certainly beats passing the time in his grim, poverty-stricken real life. Along with millions of other world-wide citizens, Wade dreams of finding three keys left behind by James Halliday, the now-deceased creator of OASIS and the richest man to have ever lived. The keys are rumored to be hidden inside OASIS, and whoever finds them will inherit Halliday’s fortune. But Halliday has not made it easy. And there are real dangers in this virtual world. Stuffed to the gills with action, puzzles, nerdy romance, and 80s nostalgia, this high energy cyber-quest will make geeks everywhere feel like they were separated at birth from author Ernest Cline.--Chris Schluep

That review made it sound a little formulaic and it could easily have fallen into that trap, but blissfully it doesn’t.  It’s a fast paced, highly entertaining, well written book and my inner geek loved each and every bit of it, especially the retro 80’s references; from Devo to AC/DC, Dungeons and Dragons to Car Wars (awesome!) and from Ferris Bueller to Family Ties.

As a bonus, this is Ernest Cline’s debut novel.  If he keeps up this level of writing or, even better, improves then I can’t wait to see what he comes up with next!

P.S. In the interests of full disclosure I’ve got no affiliations with the book or author and I get no kickbacks for mentioning this book, though I wouldn’t mind if there were some, hint, hint!

If you haven’t read it, go grab it (just a suggestion) and if you have, did you enjoy as much as I did?

Nov 11, 2011

Underscores in Test Names are a Pain to Type, Right? Not Anymore!

It might be a large assumption given some of the customers I deal with, but I’m going to assume you write unit tests.  I’m also going to assume that when you write tests your test names have underscores separating all the words and making your test names human readable. Something like This_is_a_really_long_test_name_but_thats_ok_because_its_easy_to_read_when_I_use_underscores.

The only (minor) problem I have with this approach is that underscore isn’t the easiest key to type.  I’d rather just hit the space bar and have Visual Studio change that space to an underscore for me – after all, that’s exactly what computers are good for :-)

Here’s the good news, there’s a great little ReSharper macro that has been developed that does just that – it’s available from and all you need to do is create an R# live template that wires the macro up to your test name field in a live template.  For example:


Now when you use the live template to create a test you can simply type the test name with spaces and they’ll be converted into underscores for you automagically.  Fanstastic!

Kudos to Joar Oyen for his great work, and feel free to check out his blog post for how this works under the hood.