Monday, 25 May 2015

2015 British General Election - Progressive Alliance What If?

Rather off topic for me on this blog but thought interesting nonetheless to publish... I was taken following the personally rather disappointing UK election results by a comment by the Green MP Caroline Lucas reported in the Guardian.

Reflecting on the result, she is quoted as saying...

The system is wrong and we should have electoral reform, but that could be some time coming. So we need other ways to work together in a progressive alliance. Where it is appropriate, only one progressive candidate could stand in a seat – a sort of electoral pact...

Which got me interested in the numbers, in particular considering what the change in the result might have been if such a pact was in place for 2015. Clearly there's a lot of assumption in this - not least the fact that I'm using the hindsight of the actual results to determine what might have been different, which is rather circular. It also assumes that every voter that would have voted say Liberal Democrat would be happy to vote for another party in the "alliance", which is unlikely to be 100% the case. It would certainly need some messaging effort between now and the next election to ensure people accepted that their party preference would be counted, albeit in a different constituency.

So to look at the numbers I downloaded the full set of results for all constituencies in England, Scotland and Wales, that is available from the British Election Study website. I then found all seats the Conservative won and worked out if they would still have won if one of two alliances were in place - firstly between the Liberal Democrats and the Greens, and secondly including Labour as well.

Having found the seats that would have changed hands in this scenario, I then looked at the actual votes cast for the "alliance" parties in these constituencies. I used this to calculate a fair means of allocating which actual party would be given the seat. Again this takes some liberties with timings - in reality the choice of which party was standing (and which was standing aside) in each seat would need to be made before voting of course. But it does seem like a reasonable basis for such a decision if something like this were planned for the next election.

Finally then looking at how this pans out. Firstly, in the scenario where there's an alliance between the Liberal Democrats and the Greens, there's a fairly minor change. Five seats would change hands, which given the breakdown I've used would give the Greens a further MP and the Liberal Democrats a slightly less disastrous loss of MPs to twelve instead of the eight they retained in reality. A significant Conservative majority would still have been the result.

Where things become more dramatic is if Labour is included. Pollitically this may be far-fetched, but electorially it would likely make sense - particularly in areas such as my home region of the South West, where they are third or fourth party at best in most constituencies. In this scenario, the Greens have five MPs, Liberal Democrats three times as many at twenty four and Labour an additional twenty six. The Conservatives remain the largest party but sixty short of an overall majority.

The data and analysis is available for view and review as a Google doc here.

Thursday, 21 May 2015

Sample Site for Merchello with Umbraco

For a while now, since last Codegarden in 2014 in fact, I've been planning to take a look at Merchello, an e-commerce framework for Umbraco. In the past I've made use of uCommerce which worked well for the project but the fact that, like Umbraco, Merchello is open-source is one factor that makes it attractive to consider for future projects.

So on and off for the past few weeks I've built out a very basic store site. Really doesn't look like much and has little in the way of bells and whistles, but implements a number of the core features required for an e-commerce website, namely:

  • Product category and product pages
  • Products with variants, with price and availability indicated for the particular variant selected
  • Basket page with quantity update and option to remove
  • Billing and shipping detail collection
  • Delivery method selection and application of postage & packing costs
  • Selection of payment method
  • Integration with a credit card processing provider, Authorize.Net
  • Presentation of confirmation screen

Nothing in the above is particularly off the beaten track when it comes to Merchello - there are a number of extension points available that I've not dug into yet.

That said, in building this out I did find myself digging into a number of documentation pages and examples (plus forum posts of course) which as is often the case with a fast moving project, sometimes struggle to keep up with the latest features.

I've also followed some stricter MVC patterns I like to use with Umbraco development, which is to use route hijacking, strongly typed POCO view models and mapping with Umbraco Mapper and AutoMapper from my Umbraco content and the Merchello APIs and objects respectively.

For both those reasons think it's worth sharing and may be of use for anyone else making a start with this product. Code is up at GitHub.