30.06.2013 Views

Book of Red Gate 2010 - Red Gate Software

Book of Red Gate 2010 - Red Gate Software

Book of Red Gate 2010 - Red Gate Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Code <strong>of</strong> the Year 2009<br />

Heaps <strong>of</strong> astonishingly good engineering is created and<br />

French polished by hand at <strong>Red</strong> <strong>Gate</strong> every year. We’ve<br />

decided to celebrate this and from a field <strong>of</strong> seven entrants,<br />

Neil ‘First Coder’ Davidson managed to pick the winner <strong>of</strong> the<br />

Golden Brackets Trophy 2009, “because it has lots <strong>of</strong> complicated-looking<br />

shit in it and it’s better than Rob’s solution (which<br />

I’m assuming was awesome)”.<br />

This is (part <strong>of</strong>) the code that allows us to put blue blobs on the object<br />

explorer in SQL Source Control.<br />

This bit <strong>of</strong> code is clever because the first two approaches we took to solve<br />

this problem were completely different (Rob and Elliot’s pro<strong>of</strong> <strong>of</strong> concepts),<br />

and we eventually settled on this approach because it should cause<br />

the least problems for SSMS: it already expects there to be many different<br />

kinds <strong>of</strong> builders for the different types <strong>of</strong> nodes in the tree, and therefore<br />

it shouldn’t cause SSMS to deadlock, crash, or misbehave in other ways.<br />

Finally, I like it because it has an anonymous delegate,<br />

a lambda function, a bug was found and fixed in it (follow the SOC<br />

number), it uses our own wrapping around both the C# locking and the<br />

reflection APIs, it uses the Set class from Shared.Utils, and even though<br />

it’s fairly short it provides rather a lot <strong>of</strong> the start-<strong>of</strong>-day functionality<br />

that is needed for blue blobs.<br />

Cheers,<br />

David Simner<br />

17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!