MoreLINQ – IEnumerable Extensions from Jon Skeet

I’ve just become aware of this MoreLINQ project containing some neat IEnumerable extensions authored by the inimitable Jon Skeet.

I particularly like the look of DistinctBy – that’s gotta be a lot easier than passing custom instances of IEqualityComparer into Distinct().

Fun fact – I used to work with someone who went to school with Jon Skeet! True Story!

Team System – Build Details Enhancements in VS2010

It’s been a while since I blogged anything complimentary about TFS / Team System, so I thought I’d mention that I appreciate the improvements to the build details screens in VS2010.

Here’s how a particular completed build appeared in VS2008:

 vs2008

And here’s how the exact same build appears in VS2010:

 vs2010

A little effort on the UI has really improved the user experience here.

I particularly like the cute graph of recent build durations and outcomes. This is useful for builds that are currently taking place, as you get an idea of how long the build is likely to take to complete:

building

Hobson’s Choice, Citibank Style

Dear Citibank. Last time I checked, JavaScript had a confirm() method. Kthxbai..

25-02-2010 08-39-52

.NET Framework 4 – Why The Drop In Precision?

OK, why is is it Framework 4 and not Framework 4.0? The differing precisions in this drop-down are playing havoc with my OCD.

17-02-2010 09-43-08

Also, I see Scott Hanselman mentionedC# 4 (not 4.0, the marketing folks say it's .NET 4, etc.)”.

Those crazy marketing folks. I’m sure they just do it to screw with my head. They’ll be sorry come Autumn when they need a .NET 4.1…

VS2010 – MyClassInitialize Has Wrong Signature

Having just upgraded an existing solution to target Visual Studio 2010 and .NET 4.0, I found all of my MSTest unit tests were giving the following error message:

Method TestProject.TestFixture.MyClassInitialize has wrong signature. Parameter 1 should be of type Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.

This was caused by all the test projects still having a reference to version 9.0.0.0 of Microsoft.VisualStudio.QualityTools.UnitTestFramework. Having removed this and added a reference to version 10.0.0.0, all the tests are now working just tickety-boo.

Hope this helps someone…

On the Inherent Negativity of Computer Programmers

A couple of weeks ago, early one morning, my friend and fellow coder Scott asked a curious question:

“Do you think that programming computers for a living gives you a negative outlook on life?”

Now, Scott is unfortunately responsible for administering occasional TLC to a codebase that I cut as long ago as 2004, so I assumed he was referring to this and was about to raise some complaints about my hand-rolled query object criteria framework or other coding horror. I steeled myself to defend my work as he continued to explain:

“Well, when coding we have to consider all the potential edge cases and exceptions – what happens if our methods get dodgy inputs etcetera. And it’s spilling over into my real life. We’re moving house at the moment, and I just find myself worrying about what happens if the buyers pull out, if we can’t get the mortgage, if the survey reveals problems… I’m really negative about the whole process.”

At the time I smiled and put this down to the notoriously tortuous British house-buying process, but the more I think about it, the more I think Scott might be onto something.

Pissed Off Ian, by John Conners My wife and I are currently plotting a well-deserved summer vacation in sunnier climes, which theoretically should be an enjoyable task, right? But I can’t simply enjoy it and focus on the “sunny-day scenario”. My mind is full of edge cases (“What if we can’t fit all our stuff in the car?”), unhandled exceptions (“Will we get our passports in time?”), compatibility issues (“will our choice of dates suit my clients?”), unwise over-reliance on dependent components (“Will the airline have any child seats available?”) and of course user errors (“Suppose we book the wrong dates?!”). No focusing on the happy path for this codemonkey.

The more I think about it, the more I see that Scott has a point. Professional software development forces us to anticipate invalid input, stupid users, hackers,  insufficient hardware, unreachable remote services, and whether our software can pass the Turkey test. We consider SQL injection, cross-site scripting, buffer overflows, and countless other common threats and exploits. Not to mention worrying about what happens when other devs get their grubby mitts on our codebase, or when the client inevitably unleashes some game-changing requirements late in the lifecycle. We’re all about expecting the worse, coding defensively, and decoupling ourselves from dependencies. The ever-present potential for high-profile failures caused by something as simple as an inverted boolean comparison, combined with the likelihood of critique and criticism from our fellow coders, DBAs, auditors and sysadmins is enough to turn most devs into a nervous wreck before they’ve so much as initialised a variable. That reminds me, I must check that my Professional Indemnity insurance policy is up to date.

sb So, anecdotal evidence and my own experience suggests to me that Border’s First Law is a truism. Programming Computers Can Cause Negativity, Cynicism and Pessimism.

Are these necessarily negative traits to have, or can such enforced forethought and consideration of potential issues be a benefit in “real life”, away from the screen? I suspect as with many things, the answer is that there is some balance to be had. So – getting to the airport on time is A Good Thing. Spending a fortnight’s vacation panicking on the offchance that the flight operator goes bust is, probabilistically, a bit silly.

I’m not sure where I’m going with this, or what the answer is, except perhaps to be a little more aware of this mindset and try to adopt a little restrain when applying programming principles to “real-life” conversations. Life, alas, is not a well-defined algorithm, and God knows it doesn’t come complete with a full suite of regression tests.

PS – You know, I just remembered that I blogged about this topic before!

Most-Read Posts 2009

Courtesy of Google Analytics, here are my top 10 most-read blog posts from 2009:

Posts published in 2009 only:

  1. SOLID Development Principles in Motivational Posters (12 February)
  2. Empty Catch Blocks (11 June)
  3. TFS: Using Alternative Diff/Merge Tools (19 May)
  4. ASP.NET Just Became a Legacy Platform (22 March)
  5. Welcoming Barclaycard to the 21st Century (21 October)
  6. Bohemian Rhapsody in Digg Comments (06 February)
  7. Moo.com – Customer Service Done Right (07 May)
  8. New Office Photos (22 May 2009)
  9. On 64-bit TFS, Virtualization and Conchango SCRUM (23 January)
  10. .NET Coding Standards (23 January)

All Posts:

  1. Team Foundation Server – Sharing Binaries and Class Libraries across Multiple Projects (17 March 2007, Last Year #1).
  2. A Serializable KeyValuePair Class (17 September 2006, Last Year #2).
  3. Is My String Empty? Some C# Performance Metrics (30 July 2004, Last Year #3).
  4. Spot The Misleading Graph (19 February 2007, Last Year #5).
  5. Postcode Validation (23 May 2007, Last Year #4).
  6. MSB3247 – Dependent Assembly Conflicts (04 December 2008, Last Year #22).
  7. A C# Postcode Struct With Parser (29 May 2007, Last Year #6).
  8. Getting Daemon Tools to Install on Windows Vista Beta 2 (08 June 2006, Last Year #9)
  9. SOLID Development Principles in Motivational Posters (12 February 2009)
  10. Empty Catch Blocks (11 June 2009)

Christmas Presents 2009

Here’s what was waiting for me under the tree this year:

Thanks to all those who gave Santa a helping hand!

Previous years – 2008, 2007, 2006, 2005.

Deduplication Fail

Oh, the irony!

Deduplication

Spotify Mobile Rocks My World

I’m really enjoying being a Spotify customer, especially since they released an app for the Android mobile platform (I’m the proud owner of an HTC Magic). I was planning to write a quick blog post simply enumerating the things I love about Spotify, but first, to give some historical context I thought it might be interesting to consider how I consumed music just a decade or so ago.

The Way It Was

iStock_000000895902XSmallWhen I started university fifteen years ago, I did the only sensible thing with my first grant cheque. I took it to Richer Sounds and blew the lot (and then some) on a bloody big hi-fi separates system.

For many years it was my pride and joy, and I diligently performed all of the standard audiophile tricks in an effort to make the music it played sound as close to perfection as was humanly possible. The speaker stands were weighted with sand, the components were loving joined together with high-quality directional interconnects, and the amp was always turned on after the sources. Basically, I spent as much time trying to attain musical nirvana as I ever did cramming for my exams on Game Theory and Combinatorial Counting.

From where did the music come that I played on this hi-fi? Religiously each Wednesday I bought and scoured the Melody Maker and New Musical Express, reading the reviews, editorials and adverts and obsessively making lists of the vinyl and CDs that I had to buy the next week. When the following Monday arrived, I would cycle to SelectaDisc, procure my weekly fix, and cycle back to digs as fast as my legs would carry me.

And then there was the whole glorious experience

Slide the inner sleeve out of the outer sleeve. Slide the vinyl out of the inner sleeve. Blow it. Dust it down carefully with carbon fibre brush. Drop the disc on the platter. Set the turntable going. Drop the needle into the run-in groove. Turn the amp on, and the volume up. Lie back, be surrounded by sound, and inspect the artwork. Aaaahhh…

 

The Way It Is

spotify Well. That was then, this is now. I’m pleased to say that the hi-fi still works fine, but I no longer have the time to give it the attention that it deserves, so I’ve given it to my eldest nephew.

Of course I still love music, but quantity, time and convenience are now of higher importance to me than sound quality and overall experience. And this is where Spotify fits perfectly into my current lifestyle.

For example, a few minutes ago I read that a new Sufjan Stevens LP has recently been released. A few keypresses later, and I’m listening to it. A few more touches on my Android-powered phone, and it’s downloading over wifi for me to listen to at the office tomorrow. The simplicity and ease of use is staggering.

Unlike with managing a large collection of MP3s, I have no files to organise, backup, and worry about losing. Unlike with CDs, there is no physical media to be ripped, stored, and worry about the kids scratching. There’s just the music, on demand, whenever I want, at the touch of a few buttons, and all for just a tenner a month (roughly the price of an album, then).

As a result, I find myself listening to an increased variety and quantity of music once again. On the one hand I can rediscover long-forgotten gems from my younger days, and then on the other I can be more adventurous, the subscription model rendering tracks and albums free of risk. It’s an absolute joy.

No Downside?

Hardcore record collectors must be turning in their graves, and indeed I can’t bring myself to get rid of all the cherished vinyl languishing in my loft. But, for hassle-free accessibility to the music itself, Spotify is difficult to beat.

If I had to pick holes in the service, then the obvious starting point would be the holes in the collection. Nothing at all by The Beatles, Led Zep or Pink Floyd. No sign of Arcade Fire’s first album, or The Proclaimers' “Persevere” and “Born Innocent” opuses. I can’t see any Ian McNabb, which is unfortunate as I have a soft spot for “You Must Be Prepared To Dream”. Older Snow Patrol albums are missing, as is Prefab Sprout’s “Jordan – The Comeback”, and Mull Historical Society’s “This Is Hope”. I’m sure there are many, many others, these are just the omissions that are bugging me at the moment.

The mobile app doesn’t scrobble to last.fm, and the fact that I sorely miss this makes me realise how weak Spotify’s whole recommendation and social networking story is. But this can easily be enhanced over time, and in the short term I think the company are right to focus on extending the catalogue and improving the overall quality of the service (increased bitrate, offline capability, availability on mobile platforms).

Now.. what to do with all those CDs gathering dust on the shelves…?