Jan 13, 2015

The ANZ Coders VIRTUAL Conference

I love developer conferences. They’re a great way to learn new things and to connect with various people in the dev community I might not normally meet. There are also some great conferences in Australia and New Zealand for developers – the DDD conferences in Melbourne and Brisbane, the wonderful CodeMania conference in Kiwi-land and the Yow! conferences that happen along Australia’s east coast each year.

Unfortunately for me, I struggle to find the time to attend these conferences. They often clash with work or family commitments, and most are outside my home city adding extra costs to attend and increasing the time away from my family. I presume this would be the case for a lot of other people as well, especially those in country areas or cities where there are no conferences at all.

I could whinge about it or I could do something about it. I decided for option 2 (after doing a little option 1)

Announcing the ANZ Coders virtual conference!

As the tag line says, this is the developer conference you can attend in your pyjamas!

As I said earlier, the interactions I have with the speakers and other attendees are a vital part of any in-person conference and with ANZ Coders I wanted to make sure that an equivalent level of interaction could be possible during the conference. To this end we’ll be using crowdcast.io to host the conference. Each session will have an open chat room (much like Twitch.tv has for game streaming) and people will be able to interact directly with the presenter, live, while the session is on air! We’ll also have Q&A and polling features for other interaction options.
This won’t just be a bunch of one-directional screencasts you can fall asleep in.

Additionally I wanted to make this as accessible and inclusive for developers as possible, so we’ll be running the conference for two hours a night for a whole week, starting May 25th. That way, if you’ve got something happening one night, you can still make it to the other nights and be a part of it. At only two hours a night we don’t wipe out your entire evening with the family either.

So, what happens now? Currently we’re asking for speakers to submit 30-minute session proposals. After that, we’ll put all the proposals up for an open vote by the community and ask the highest voted topics to present. Too easy, right?

Head on over to the conference site for more information and don’t forget to mark the week of the 25th in your calendars. I hope you can join us!

Nov 17, 2014

Viewing Git Commit Statistics in TFS

I thought this might be useful for some of you.

A question on StackOverflow asked if there’s a way to see any stats on git commits stored across a large number of repositories in TFS. The quick answer is “No, there isn’t. At least not directly”. The slightly longer answer is “Sure. If you’re willing to write a little SQL and maybe create a report to visualise the data”.

You may recall a little while back I posted on how TFS stores git repositories in its database. There are a number of tables in the database related to commits, and we can use this to get some useful information that we can then turn into stats. Here’s the query:

use [Tfs_DefaultCollection]

select r.Name, u.FullName, m.CommitTime, m.Comment 
from dbo.tbl_GitCommitMetadata m
left join dbo.tbl_GitCommit c on c.InternalCommitId = m.InternalCommitId
left join dbo.tbl_GitRepository r on r.InternalRepositoryId = c.InternalRepositoryId
left join dbo.tbl_GitCommitUser u on u.InternalId = m.CommitterId and u.PartitionId = m.PartitionId
order by r.Name, u.FullName, m.CommitTime

Here’s an example of the output from within SQL Management Studio, looking at a RestSharp repository I pushed to my TFS instance, so you can get an idea of the result:

image

Nov 13, 2014

“Smart Unit Tests” Are “Pinning Tests”

You’ve probably seen all the various announcements from Microsoft today, with the most notable being the release of Visual Studio 2015 Preview and the jaw dropping move to open source the .NET Core Framework. Fantastic stuff! Though I won’t go into it in detail here.

What I do want to cover are the “Smart Unit Tests” released with the VS2015 Preview, based on the Microsoft Pex research project. The messaging around it has created more than a little confusion. In fact, here’s what one of my colleagues on Twitter sent my way:

During the MVP Summit I spent some time with the people who built this feature to better understand what the intent behind these so called “smart” unit tests. Is it simply so we can tell our managers that we can hit that magic 100% unit test coverage mark now, meet our KPI’s, claim our annual bonus for hitting an arbitrary metric, and still be able to produce rubbish quality applications or is there some other value to it?

It turns out that the purpose of the Smart Unit Test feature is to help people in their refactoring efforts. It’s good practice before you go and refactor code to ensure you have a healthy level of test coverage in place so that you can be confident that any changes you make to code don’t break the behaviour of the application. On existing, legacy code without tests, this is often a very expensive and difficult process, and as a result many refactoring efforts occur either without any test coverage at all or simply never happen because they’re too scary.

This is where “Smart Unit Tests” come into play. They help you do the “smart” thing and create unit tests that help you pin down the current behaviour of the code, before you do any refactoring.  These type of tests are known, unsurprisingly, as pinning tests.

Here’s a good description of a pinning test (source), emphasis added:

A “pinning test” is not a good test. It doesn’t try to be. It’s just the simplest, fastest-running test you can write that will allow you to refactor your code. It’s often an end-to-end test, but it could also look at your log files, monkey-patch a core library function, or do something similarly ridiculous.

The key here is that the pinning test lets you do your dozens-of-tiny-refactorings loop really quickly. As the code improves, you add high-quality unit tests. Once the tests are good enough, you get rid of the pinning test. Lather, rinse, repeat.

Hopefully that helps clear up some confusion. Oh, as a final note, Brian Harry mentioned that the Smart Unit Tests name is likely to change. Let’s hope so! :-)