Ignoring the 10%

Browser support and cross-browser testing is a tricky subject. As a veteran of the browser wars I’ve seen a number of browsers dominate for a while then tail off as a new generation invariably comes through. In each generation we as web developers look to be in a better place but are always seem to be held back by the legacy of previous generations.

Back in the early 2000’s there were basically two browsers of note (I am deliberately generalising here and am well aware there were more than two browsers) IE6 and Netscape, roughly speaking it was a 90/10 split. IE6 was the ground breaking browser, way better then Netscape, and it was believe me. As a developer you spent most of your time developing to IE6 well aware of the fact it probably broke a bit in Netscape. Never a comfortable situation but it did allow you to take advantage of the better features in IE6 which seemed a good compromise.

Fast forward a few years and the next chapter in the browser wars, the standards movement. Raising Microsoft out of their slumber it pushed the web forward, IE7 was awful, IE6 the bane of developers lives with IE8 and Firefox the leading lights. It was bad for a few years but we moved forward, slowly but surely we started leaving behind IE6, sure there was still 10% of people using it but sacrificing these users for the good of the 90% was acceptable.

And now we are in modern times, Chrome has emerged as the new darling of browsers, IE9/10 makes it again one of the contenders, Firefox is still in the mix and everywhere mobile is the new must support platform. And then there is IE8… Yep you guessed it, representing about 10% of your users.

Given the importance being placed on mobile as a platform, and the fact that most mobile/tablet computers have fairly good support for modern standards is it time to sacrifice the 10% again. Some big sites and big players such as Google have already signalled the end of IE8, is it time for this to become the norm? IE8 usage will only drop and mobile looks set to increase, in my eyes the time is now…

Non Native Form Controls

Been a while since I did a blog post, been probably the busiest I have ever been over the past 3 months, but I have been a bit disappointed that I have let my blog suffer as a result. Continuing in a slightly negative vein I’d like to post about something that as a developer I just don’t get.

I’ll freely admit that I’m not a designer and that if I was I’d probably get just as annoyed when looking at a design where something doesn’t quite fit in with the overall feel as when I see a piece of code which is not as aesthetically pleasing. However if the code works I’m inclined not to change it, after all if it ain’t broke don’t fix it. So why, if there are such compelling reasons not to, do designers insist on changing the look of native form controls? Specifically I am talking about <select> and <input type=”file”> for fields, although this can easily be extended to checkboxs, radio buttons and to some extent submit buttons.

I won’t argue as to the how good or bad they look as to me its a bit of a non issue, but I can come up with some fairly compelling arguments as to why changing them, probably through the use of JavaScript is a bad idea.

  • Native controls are bullet proof – by this I mean the browser makers have spent considerable amounts of time coding and testing the native controls to ensure they work correctly. They have found and fixed all of the hundreds of edge cases, as opposed to a JavaScript solution which potentially cannot handle a multiple selection use case, or a list which is 1000 options long.
  • Native controls are future proof – what happens to your JavaScript implementation when a future browser gets released that changes the way it handles scroll events? Native controls don’t suffer from this, they will work in future releases as the browsers makers test them for you.
  • Native controls are familiar – everyone who browses the web will have come across a native control, will recognise is and will be fairly comfortable with how it works. In terms of usability you can’t trump that.
  • Native controls are accessible – going back to my first point, native controls have a lot of inherent accessibility built in, you can use the mouse or keyboard to interact with them and things like screen readers are well aware of them. Unless your JavaScript implementation covers all the same use cases that a native control does then you are simply using a inferior form element.
  • Native controls are (more) secure – a standard file control has a lot of security built in. Drag/drop interfaces whilst nice don’t always have this inherent security built in.
  • Native controls are cross browser compatible – you don’t need to worry whether your JavaScript implementation works in IE6, it just does.

This list isn’t exhaustive but it does highlight the advantages of using native controls. I’ll give a couple of recent examples.

For a project I recently did one of the requirements was to be able to upload a file via a public interface. The design had a lovely branded purple browse button and accompanying , which granted probably looked better than the standard browse button. I explained at the start of the project that styling a file form field is difficult to do and I wouldn’t recommend it. Regardless it went ahead, but I caveated my quote with a non guarantee that it would work cross browser. I styled the button using a JS implementation and for the most part it worked. I then got a bug report that it didn’t work in Firefox 14, sorry I can’t guarantee it will work. Not a huge deal as it turns out the work/won’t work scenario was intermittent (great!!). Next is this doesn’t work in iPad, well no of course it doesn’t file fields don’t work in iPad, thing is that on an iPad the native file field would be greyed out and disabled, the styled file field isn’t, there are probably a hundred mobiles that this is the case for. If we had used a native form field both of these problems would not have been a problem, it still wouldn’t have worked on an iPad but at least the user would have known.

The second example (from the same project) was that a drop down menu that had been styled didn’t work in Safari 6. It was another JS implementation, fairly good cross browser support and had recently been updated so still actively maintained. But still it had certain use case where it didn’t quite work as intended.

I’m not going to argue that layering on top of native form fields isn’t a viable progressive enhancement technique especially if there is a good usability case for improving the functionality. However to do it for purely design reasons ignoring the disadvantages of doing so doesn’t seem like the brightest idea to me. Stick what CSS can do and you can’t go far wrong, bring JavaScript into the equation and you’re asking for trouble.

Now I have to get on with some work, ah yes a lovely dropdown menu design sigh…

Clash Of Clans Cheat And Hack Tool

Techno-baby!

Over the past year or so my Apple product ownership has gone from zero -> four (well maybe 6/7 if you count peripherals). Is this because I am now a Fanboi and will join the queuing masses in the coming months when the iPhone 5 is announced and camp out for days to be the first, yes the first to own it for a nano second. The short answer is no, I’m still not a massive fan in fact when I spent £1500+ on my first Apple product I felt dirty inside and the yorkshireman in me died a bit more. Don’t get me wrong the products are all good, a nice quality, but are still overpriced for what they are. I could have bought 3 decent laptops over the next 5 years for the price of the Macbook Pro. I bought these devices because as a developer it opened up more doors for me.

So around Christmas time when I was trying to desperately come up with a good gift for my wife I turned to Apple once again and bought an iPad. The device doesn’t fit my needs personally, if I’m surfing the net then I want to do it on a fully functioning laptop. If I’m casually surfing, my phone suffices. For my wife however it did fit the need, I wanted a replacement to my wife’s ageing netbook and the iPad fit the bill.

I also had a sneaking suspicion that my one year old Adam would take to it as well. What I didn’t realise was how much and how easily he would take to it. Bear in mind that we are talking about a baby who cannot yet talk and has the attention span of a fly. He was instantly hooked, and in some ways obsessed with the device. It could keep him amused for minutes (a big thing for him)! He instantly got the interaction and was happily switching between apps and making noises, and turning the screen to flip it to the right side. Amazing really for someone so young.

Fast forward 6 months and whilst he still can’t talk (he’s getting there) his level of understanding of what the iPad plays is astounding. We downloaded apps that make animal noises as he likes animals and the education that the iPad has given him is brilliant. As the following video shows, he can identify animals I wouldn’t have believed possible for a 21 month year old. And he definitely hasn’t memorised the locations, they change between portrait/landscape modes, and there are multiple pages. He literally knows what an Elephant is, looks like and sounds like check this link right here now. The video doesn’t show it be he equally can point out flamingos, camels and crocodiles, not your average farm yard.

I never had anything like this as a kid, as obviously the technology wasn’t there, but today it is. I am filled with a sense of awe of what children today will be achieving in 20-30 years with a foundation such as what is the norm today. Technology is amazing.

Do you need a CMS?

I’ve recently started a new project for a client based on the Joomla CMS. Its been a while since I’ve done anything serious with Joomla but I’ve always been able to work with most things so wasn’t overly concerned by the project. The project itself is basically a re-skin of the existing site, no new functionality per se but nice treatment of the content to suit the sites objective of selling the business to the paying public. Now not being a massive expert on Joomla may hinder me slightly and achieving what I want to achieve has probably taken me more time than I expected but what it has done is re-affirmed my belief that ‘out of the box’ CMSes are simply just not worth it.

I have always been a big advocate of bespoke CMSes (or no CMS) and here are some reasons why

  • Your project rarely if ever fits the functionality that a general purpose CMS provides
  • Plugins which fill the holes a CMS has are not a good solution – the quality varies considerably and invariably breaks the upgrade path
  • Time saved in utilising the CMS is most often offset by learning the CMS and working around what it does by default
  • Security of a popular CMS is often low – its a big target of automated vulnerability scripts
  • A CMS 75%+ of the time isn’t used or required, in my experience clients rarely use the CMS, or worse get you to use it for them
  • Budget for a CMS is better spent elsewhere

About the only time this isn’t the case is when you are doing something very specific with a site such as a pure blog, or an ecommerce solution. CMSes just aren’t worth the benefit they provide. This may seem like an odd stance from someone who makes a living basically selling CMS work but experience has taught me that my thinking is more often than not right.

But, but the client needs to be able to update the site themselves… Really they absolutely have to be able to do that? What like twice a year? Seriously if I built a site and the client wanted to make some text amends to a page it would take me about 5 minutes to do it, and more often than not I wouldn’t charge for it, the time taken to raise an invoice outweighs the dev time. If its more than simple text amends, like adding a new section then I’d quote for this work, and you can do more with it. It still probably works out cheaper for you in the long run.

Its a different matter if the site is constantly being changed, a CMS makes perfect sense then, or if the site has a news/events/directory section then again a CMS makes sense, but in those situations go bespoke, it will be quicker and cheaper to build than trying to get Joomla/Drupal/Wordpress to do what you need. Or perhaps try Perch which does a grand job as a small CMS for a bit of text changing.

In the meantime, Joomla you and I have some time to spend together.

2011 Review

Well another year comes to an end so I thought a traditional review would be in order.

This year has been a different one for me, my first year working for myself. I can only say it has so far been nothing short of a success. Whilst I perhaps haven’t had as many clients who are purely mine as I would have liked I have nonetheless forged some really good relationships with other agencies both big and small. I have also renewed old relationships with some old work colleagues who have also gone out on their own.

I have also dabbled in my first contract position which has also proved to be to my liking. I like being able to add something different to the project mix and bring my experience to the fore. All this without having the ultimate responsibility for multiple clients has been refreshing for me personally.

Overall it has been a lot of hard work and I’ve probably worked a bit too much this year. I’ve found it especially hard to turn work down and this has been to my detriment sometimes.

Going back to development after a few years out has also been good. It hasn’t taken long to get back into the swing of things and all the old skills returned. I’ve also learnt a few new things this year. JQuery is fun and makes JavaScript a pleasure again, I hope to get a lot more proficient with this. I’ve also tried out RabbitMQ which was cool, a little Amazon EC2 and integration with both Google Checkout and Sagepay. All very good experience.

My business knowledge has increased although I think I have been lucky so far with my clients and I haven’t had any bad experiences yet which is good. Long may this continue. Managing cash flow has perhaps been the hardest part of working for myself. I think I’m in a fairly good place right now but it is worth keeping an eye on.

I had hoped to devote a bit more time to this blog and whilst I managed to do this early in the year the second half waned a bit due to workload pressures. I’ve still managed (just) at least 1 blog post a month which is my aim to continue. As the second anniversary approaches I’m glad that I have kept this up. Would still love to grow my audience a bit.

Finally from a personal point of view this year continues to keep me on my toes with my wonderfully energetic son. He changes practically every day and watching him grow up and master new skills is very rewarding. Still by far the biggest challenge I have ever faced but one I intend to continue to rise to.

As for 2012, well assuming the world doesn’t end, I have a lot more goals. Try to re-balance the work/life situation is one, continue to learn and get more clients and relationships. Nothing extreme a steady progression is all I ask.

Good luck t

Rugby World Cup Post Mortem

So the rugby world cup is over, well for England anyway, for the teams which have embraced the future it continues and good luck to them all. For England the glory days are well and truly behind them 2000-2003. It was always going to be hard to live up to the world class team of 2003, but we’ve been in the doldrums for a while now, and its simply because the game has moved on.

England have nearly always played knock out rugby well, 2007 being the prime example. Grind out results, hey it might not be pretty but it works. Unfortunately it no longer works over 7 games and things need to change drastically or England face many years of toil, disappointment, the occasional high followed by many lows.

Could the quarter final knockout actual be good for England. The answer is yes if they learn from it. I’m no coach, just a long time fan of the game, but I’d like to analyse 5 things which I think needs to be looked at. Take them with a pinch of salt of course, and feel free to disagree, this is my list and I’m not even qualified to comment, its more of a rant than anything else.

Another point to make is that I’m not going to touch on the media circus surrounding the team. Off pitch calamities have been overblown and help no one but the media outlets sell more papers. Yes the team could be more professional and make sacrifices for a 6 week tournament but that isn’t the heart of the issue.

Basic Skills

Much like a footballer who’s paid to kick a leather ball around a field the basics of the game are not that hard. In my eyes every single professional footballer should be able to dribble, shoot with both feet and head the ball, the degree of proficiency with each skill depends on your position but you should be able to do them, after all thats what you are paid handsomely to do.

In rugby the basics are throw the ball, catch the ball and tackle. Much like football your position demands different levels of proficiency in each skill but you should be able to do each of them from 1-15.

So why does the England team knock on so much, and miss so many tackles? Maybe its cause I am so focussed on the England team but it seems to me that we make far too many passes above the receivers head, drop a high percentage of pop passes and miss a lot of tackles, especially when chasing a high ball.

Come on these are the basics, if we can’t get these right how on earth are we supposed to move on to the intermediate skills? The reason the southern hemisphere teams are so much better than us is because they get the basics right. They know that if they pop a pass out of a tackle there will a) be a man on the shoulder to receive the pass, and b) that player will catch the pass.

Its all well and good having a great forward pack, but if every time a chance is created or a break is made, you know the good stuff a player does, if it breaks down because a player can’t catch a ball well thats just pathetic really.

Discipline

The game of rugby has a lot of rules, some of them are strict and are easy to enforce, like no punching or gouging etc. If you do it on the pitch either the ref will see it and punish you or you’ll get cited after the game. That’s the way of it and its the same for every game.

Other rules are a little looser and can go either way, and some of the best players in the world know how to bend the rules to their advantage. And sometimes you have to break the rules to prevent points being scored. Its always been the way and I’ve got no issue with that. You are never going to have a game where no penalties are awarded.

The ref is there to enforce the rules and some refs enforce them better than others (more on that later) but more often than not a ref is going to tell you as a player if you need to leave a ball on the ground alone or if you are in danger of giving a penalty away. If it isn’t one of those times when its give the penalty away or its points, and high points at that, desist in what you are doing. Simple as that. If you are near the half way line and isolated, and risk being turned over, let it happen. Rely on your team mates to win it back, thats what they are there for. Conceding possession, followed be territory and/or points is senseless, and infuriating to watch.

Instinct may stop a player from doing this. Well that isn’t good enough coaches need to coach this instinct out of the players, and players need to work to do it. What there needs to be is a punishment system for persistent offenders. Its no good being the best scrummager in the world if you cost a team 9-12 points a game, and label your team as persistent offenders.

New Talent

You can’t buy experience apparently well that doesn’t seem to ring true very much anymore. Experience at the expense of talent is wrong. Just because a player has played 50-80 times for your country it shouldn’t automatically guarantee you a place. The reason is that a player may have got that experience by simply being the best of a bad bunch, or a mediocre bunch at best.

I’m looking at players like Nick Easter, Louis Deacon, Mark Cueto and Mike Tindall. All good players and experienced ones at that but they have never been world class players and the experience they bring does not make up for this fact.

Our best player by far this tournament was Manu Tuilagi, young, inexperienced and therefore doesn’t know how to grind out a result. Well bollocks to that, he was cleaning up after Tindall all tournament and the only player to consistently break the line. Look at the welsh team, the team isn’t made up of experienced players for the sake of it. Hell Stephen Jones wasn’t even on the bench in the Quarters, and they didn’t even take Martyn Williams!

Its time to ditch this experience, take a plunge and build a new team. If that means we have a couple of years of being in the bottom 3 in the nations, so be it. Its better than persisting with players who are never going to be good enough. And I never thought I’d say this but that may mean ditching Jonny Wilkinson, however for me, and this is quite a personal preference I don’t think Flood is a replacement.

Injuries

Some players never have any luck, if we look back to football there are always some players who always seem to be injured. Kieron Dyer a prime example. So is the case with rugby. Some players seem to be perpetually injured.

Two players spring to mind here, Andrew Sheridan and captain Lewis Moody. On his day Andrew Sheridan is a fearsome player, strong as an Ox and a powerful scrummager. Unfortunately his days are few and far between as he’s always getting injured.

Injuries are part of the game and its gotten a lot worse in the last few years as players have gotten bigger and more mobile due to the changing game and its professionalism. Problem is players who are prone to injury are a liability.

Should a place in a squad go to a player who might last a game just cause he’s quite good. Or is his likely injury going to end up being more disruptive to the squad as a whole?

And your captain’s name is first on the team sheet, a guaranteed spot. Is certainly shouldn’t be the likely case of if he’s not injured, and he shouldn’t be coming off every game after 60 minutes. If you’re prone to injury you probably are not worth the gamble, sad as that may be.

Referees/Laws

My final point is probably going to be a bit contentious as I have always considered the refs in rugby to be sacred and not to be argued with. But for a while now refs have been ruining the experience of watching the game.

The best refs for me have two qualities, they let games flow and deal with incidents as and when they need to, and they treat both teams the same. Sometimes these can be at odds with one another as if the ref is going to be strict and punish both teams then the game doesn’t flow but I’d rather have that than a ref who calls one team up on everything and lets the odd thing slip for the other team.

I would never go as far as to say refs are intentionally biased as I really don’t believe they are but I would say refs can be influenced by the state of a game and give decisions based on what has gone before.

The people running the game need to take a look at some of the rules and see where it is ruining the experience of watching. Things like the scrum where it seems either side is as likely to give a penalty away no matter what is happening.

Captains/players are talking to the ref more and more, which doesn’t seem right. But when the ref is having to explain his decision as the players don’t know what they’ve done wrong, well that isn’t right either and I’ve seen quite a few instances of that.

It may just be sour grapes but I shouldn’t be talking about the refs performance at the end of a game. I’d much rather talk about how good/poor a side have been in the game itself. Unfortunately this isn’t the case very much, and that just feels wrong.

For what its worth I thought the ref had a good game in the one which England lost, he was fair and consistent and thats how it should be.

So there we go the end of my rant. Thats what is wrong in my eyes, fixing things will be down to the England Team and Management whoever that may be post world cup. For now I’d like to wish Wales all the best for the World Cup. You were my dark horses at the start of the tournament and are playing the game which deserves to win. Whether you have enough to beat NZ is still to be seen, but I’ll be cheering you on hopefully all the way!

Bringing the Magic of Star Wars to the Next Generation

A bit more of a light-hearted blog post here. Prompted by seeing this video on the kottke blog got me to thinking randomly about the Star Wars saga today. I was born in the same year as Star Wars came out, its pretty much always been a part of my life and I have seen all six movies quite a few times!

The release order of the films was always a wonder to me as a kid, and when they announced the first three films were being made I literally had a geekgasm. Ultimately the first three films, whilst visually stunning, never really lived up to expectation. They never really had a chance, I was no longer 6 years old, my tastes and expectations had moved on considerably. My opinion now is that the first three films were aimed much like the first movies at the children and not me as an adult. You could say they weren’t as good and probably aren’t, after all the original movies are widely recognised as three of the best movies ever made which is a lot to live up to.

Anyway I’ve moved on and now I have a kid and think its my duty to introduce him to the saga as well. But now I see a bit of a dilemma, what order do I present them in? My initial reaction is the same order they were released, the same order I saw them in. But is this right? Given that the three newer movies would likely be enjoyed by him more than me and seeing the saga in chronological order should make more sense?

Seeing the kids reaction in the video above presents a strong argument to see them in non-chronological order, after all if he’d seen the third movie he’d already know Darth Vader was Luke’s father. George Lucas you have effectively ruined this surprise and many others by revealing stuff that was yet to happen in later movies – you utter bastard.

Would Star Wars have the same magic for Adam as it did for me if he saw the weaker films first? In fact would it have the same magic for him full stop, given that movies have arguably better special effects now than the original movie (although it still holds it own), would it still have the wow factor?

So what to do? I’m still undecided and don’t have to make a decision for a couple of years at least. One thing I’m sure of is there will be more difficult decisions than this to make over the coming years! In the meantime, that reaction above… priceless!

England Test Cricket – Currently Very Good

A bit of a break from the dev stuff. We’re half way through the 3rd test against India and I am already comfortable enough (weather obliging) to say England are about to become the No 1 ranked test side in the world. If/when this happens I am sure a lot will be made of it by the media and rightly so, in my 30ish years of following English cricket there have been a lot of lows and very few highs. It seems almost strange that rightly England will be the best team in the world, and we could consider them that even if they don’t claim the spot of the coming 1 1/2 tests.

If you look at the side its not hard to see why they are the best in the world, and in true geek fashion and an indulgence of my love of statistics here’s concrete proof why.

England are a very good side

Notice I have said a very good side and not a great side. They may go on to become a great side (more on that later) but for now they are just very good.

Lets start by looking at the batting. Currently if you look at the batting line up they have great/good/competent batsman all the way through the side right down to number 11. Each and every batsman has a batting average in double figures.

England batting averages – Test matches
Player Span Mat Inns NO Runs HS Ave BF SR 100 50 0 4s 6s
JM Anderson 2003-2011 62* 80 33 559 34 11.89 1563 35.76 0 0 6 69 1
IR Bell 2004-2011 68* 115 15 4792 199 47.92 9170 52.25 15 28 8 562 19
RS Bopara 2007-2011 11* 15 0 502 143 33.46 936 53.63 3 0 4 64 2
TT Bresnan 2009-2011 9* 7 0 265 91 37.85 603 43.94 0 2 0 33 0
SCJ Broad 2007-2011 40* 53 7 1335 169 29.02 2101 63.54 1 8 7 173 9
AN Cook 2006-2011 71* 124 8 5640 235* 48.62 11540 48.87 19 26 3 654 5
EJG Morgan 2010-2011 12* 16 1 513 130 34.20 897 57.19 1 3 3 59 4
KP Pietersen 2005-2011 77* 131 7 6123 227 49.37 9844 62.20 18 24 7 730 55
MJ Prior 2007-2011 46* 68 12 2526 131* 45.10 3768 67.03 6 18 8 287 12
AJ Strauss 2004-2011 88* 156 6 6300 177 42.00 12666 49.73 19 25 13 780 10
GP Swann 2008-2011 35* 40 6 800 85 23.52 979 81.71 0 4 2 98 10

How often through the 2001 tests can that have been said, not often I would guess. And if you look at the averages for most of the batsmen, Ravi Bopara aside they are all averaging 40+. Take Ravi out and bring the usual Trott only strengthens the situation Trott has an average of 57+. These aren’t the averages of people at the start of their careers they are highly established batsmen with 5000+ test runs.

At the moment any team would struggle to contain a team which can realistically get a 50 from anyone down to number 10.

Ok on to the bowling:

England bowling averages – Test matches
Player Span Mat Inns Overs Mdns Runs Wkts BBI BBM Ave Econ SR 5 10 Ct St
JM Anderson 2003-2011 62* 113 2206.3 499 7150 233 7/43 11/71 30.68 3.24 56.8 11 1 28 0
IR Bell 2004-2011 68* 6 18.0 3 76 1 1/33 1/33 76.00 4.22 108.0 0 0 56 0
RS Bopara 2007-2011 11* 7 49.2 7 199 1 1/39 1/39 199.00 4.03 296.0 0 0 5 0
TT Bresnan 2009-2011 9* 16 300.0 84 865 36 5/48 7/96 24.02 2.88 50.0 1 0 3 0
SCJ Broad 2007-2011 40* 71 1332.5 285 4102 126 6/46 8/76 32.55 3.07 63.4 4 0 12 0
AN Cook 2006-2011 71* 1 1.0 0 1 0 1.00 0 0 62 0
EJG Morgan 2010-2011 12* 8 0
KP Pietersen 2005-2011 77* 47 167.3 11 666 5 1/0 1/10 133.20 3.97 201.0 0 0 47 0
MJ Prior 2007-2011 46* 139 5
AJ Strauss 2004-2011 88* 106 0
GP Swann 2008-2011 35* 63 1401.5 282 4114 142 6/65 10/217 28.97 2.93 59.2 10 1 30 0

Not as great here if you look over the averages, mid 20’s to low 30’s for a wicket isn’t that good, but there is a decent total number of wickets between them so in reality pretty good.

So not the strongest attack in the world but far from the weakest either.

Why England Deserve to be No 1

Here’s where things start to get interesting. The above shows that currently England have a very good side but not a great side in terms of overall career figures. If you take Indias big 5 batman, Tendulkar, Dravid, Sehwag, Laxman and Gambhir they have countless runs between them and career averages that most teams can only boast of having 1-2 of per team. That’s why they are currently no 1 and why they are a great batting team.

So how come England are destroying them and other teams if they don’t have great batsmen? Well lets take a look over the past 2 years at the players averages.

Overall figures
AN Cook 2009-2011 24 39 3 2155 235* 59.86 4156 51.85 10 6 0 240 3 investigate this query
IJL Trott 2009-2011 23 38 4 1965 226 57.79 4050 48.51 6 7 1 215 0 investigate this query
IR Bell 2009-2011 20 29 5 1724 159 71.83 3021 57.06 7 8 1 203 6 investigate this query
KP Pietersen 2009-2011 23 35 4 1488 227 48.00 2459 60.51 2 9 3 195 7 investigate this query
MJ Prior 2009-2011 24 33 5 1222 126 43.64 1749 69.86 4 8 4 133 7 investigate this query
AJ Strauss 2009-2011 22 35 1 1164 110 34.23 2319 50.19 1 10 4 144 2 investigate this query
PD Collingwood 2009-2011 16 24 1 719 145 31.26 1524 47.17 1 4 2 79 8 investigate this query
SCJ Broad 2009-2011 19 24 1 634 169 27.56 977 64.89 1 3 6 79 5 investigate this query
GP Swann 2009-2011 24 28 2 527 85 20.26 610 86.39 0 2 1 62 8 investigate this query
EJG Morgan 2010-2011 12 16 1 513 130 34.20 897 57.19 1 3 3 59 4 investigate this query
TT Bresnan 2010-2011 7 6 0 256 91 42.66 587 43.61 0 2 0 32 0 investigate this query
JM Anderson 2009-2011 21 26 7 162 29 8.52 482 33.60 0 0 6 23 1 investigate this query
MA Carberry 2010-2010 1 2 0 64 34 32.00 140 45.71 0 0 0 9 0 investigate this query
CT Tremlett 2010-2011 7 6 3 47 24* 15.66 98 47.95 0 0 0 5 0 investigate this query
JC Tredwell 2010-2010 1 1 0 37 37 37.00 63 58.73 0 0 0 6 0 investigate this query
ST Finn 2010-2011 12 13 9 35 19 8.75 128 27.34 0 0 2 6 0 investigate this query
A Flintoff 2009-2009 1 2 0 29 22 14.50 37 78.37 0 0 0 5 0 investigate this query
RJ Sidebottom 2010-2010 1 2 0 15 15 7.50 23 65.21 0 0 1 2 0 investigate this query
SJ Harmison 2009-2009 1 1 1 12 12* 12 100.00 0 0 0 3 0 investigate this query
G Onions 2009-2010 3 5 5 11 4* 45 24.44 0 0 0 2 0 investigate this query
A Shahzad 2010-2010 1 1 0 5 5 5.00 12 41.66 0 0 0 1 0 investigate this query
RS Bopara 2011-2011 1 investigate this query

Those averages now are pretty much as good as India and in some cases so much better. Bell averaging 71 over the past 2 years, which includes playing Australia twice! Those are the averages of great players.

Look now at the bowling averages and the picture gets much prettier.

Overall figures
GP Swann 2009-2011 24 44 966.0 185 2813 102 6/65 10/217 27.57 2.91 56.8 8 1 investigate this query
JM Anderson 2009-2011 21 39 818.4 204 2342 93 6/17 11/71 25.18 2.86 52.8 4 1 investigate this query
SCJ Broad 2009-2011 19 36 669.0 156 1920 68 6/46 8/76 28.23 2.86 59.0 2 0 investigate this query
ST Finn 2010-2011 12 24 345.4 74 1346 50 6/125 9/187 26.92 3.89 41.4 3 0 investigate this query
CT Tremlett 2010-2011 7 14 283.3 67 872 36 6/48 8/150 24.22 3.07 47.2 2 0 investigate this query
TT Bresnan 2010-2011 7 13 269.0 77 768 33 5/48 7/96 23.27 2.85 48.9 1 0 investigate this query
G Onions 2009-2010 3 6 115.0 23 366 8 3/86 4/136 45.75 3.18 86.2 0 0 investigate this query
JC Tredwell 2010-2010 1 2 65.0 13 181 6 4/82 6/181 30.16 2.78 65.0 0 0 investigate this query
A Shahzad 2010-2010 1 2 17.0 4 63 4 3/45 4/63 15.75 3.70 25.5 0 0 investigate this query
SJ Harmison 2009-2009 1 2 20.0 6 69 3 3/54 3/69 23.00 3.45 40.0 0 0 investigate this query
PD Collingwood 2009-2011 16 14 64.0 11 173 2 1/3 1/5 86.50 2.70 192.0 0 0 investigate this query
RJ Sidebottom 2010-2010 1 1 31.0 6 98 2 2/98 2/98 49.00 3.16 93.0 0 0 investigate this query
IJL Trott 2009-2011 23 12 44.0 3 185 2 1/5 1/5 92.50 4.20 132.0 0 0 investigate this query
A Flintoff 2009-2009 1 2 24.5 5 77 1 1/35 1/77 77.00 3.10 149.0 0 0 investigate this query
KP Pietersen 2009-2011 23 16 45.0 2 148 1 1/10 1/10 148.00 3.28 270.0 0 0 investigate this query
IR Bell 2009-2011 20 investigate this query
RS Bopara 2011-2011 1 investigate this query
MA Carberry 2010-2010 1 investigate this query
AN Cook 2009-2011 24 investigate this query
EJG Morgan 2010-2011 12 investigate this query
MJ Prior 2009-2011 24 investigate this query
AJ Strauss 2009-2011 22 investigate this query

England have 6 bowlers all averaging in the low to mid 20’s. To have a team like that shows why all teams are being blown away, and england only play 4 of them in a game!

All these stats are backed up by the ICC rankings where England have 2 batsman in the top 10 and 5 in the top 20, as well as well as 4 bowlers in the top 10 and 5 in the top 20. After this test these are likely to improve as well.

Will England go on to be a great team?

So currently we England are a very good side playing great cricket. To be considered a great side they need to maintain their current form over many years. The West Indies dominated in the 80’s, Australia dominated in the 90’s/00’s. England must dominate the next 5 years to be considered a great side. They also need to up their game in other formats of the game, particularly ODI where they are wildly inconstant, the great Aussie sides dominated both formats of the game.

They may just have the personnel to do that. Most of the bowling attack are young and have many years of cricket ahead of them. Not so much with the batting side but there are players who can form the spine of the team for years to come, Cook and Bell, allowing other batsmen to come in and bed themselves into the team when the likes of Strauss and Pietersen inevitably retire.

A special mention must go to Matt Prior who is currently without doubt the best wicketkeeper batsman in the world. Replacing him when he goes will be pretty difficult but not impossible. I am not as up on the county scene to know whether there are any promising keepers coming through.

Finally I guess we should always have one eye on a good spinner, Swann isn’t young so it would be good to have backup for him. I hear Rashid has lots of potential though.

For now enjoy the good times, and long may they live!

All stats have come from cricinfo which is an amazing source. I wish other sports had such great publicly available information!

Code From Hell

There are a lot of code zealots out there who pretend to think that their chosen language is the best language ever and anyone who uses another language is dumb. I’ve lost count of the PHP vs Java, or ‘language a’ vs ‘language b’ debates I’ve seen. Sometimes it comes down to personal choice, sometimes a certain language is a better option for the task at hand and sometimes it really doesn’t matter. Personally whilst I do like certain languages I have never ruled out other languages simply because I don’t like them. Better is nearly always a matter of opinion.

What does hold universal though is that no matter what language you use there are always people who produce poor code in them. And then there are people who produce code so bad that they give programmers a bad name. As a long time reader of the blog Daily WTF you can find so many examples of bad code in just about any language, and during my career I’ve come across code which could make many an article. Recently however I have been cursed with working on a code base that is so monumentally bad that I feel compelled to share some of the best snippets. Warning: what follows may make you weep!

Has it been obfuscated?

There are functions (but not all) in the code base that simply look like they have been obfuscated, variable names have been replaced with what looks like machine generated names. That is until you look closer and you realise that no obfuscation program could be so inconsistent. Mixed amongst the seemingly generated variable names is the odd variable name that makes sense. Take this example below:

get_page_game() {
  if(isset($_SESSION['auth']['uid'])) {
    $uid=$_SESSION['auth']['uid'];
    $ip=$_SERVER['REMOTE_ADDR'];
    $date=date('Y-m-d');
    if(isset($_POST['gameID'])) {
      $i0l1101=isset($_POST['userID'])? preg_replace('/[^\d]/','',$_POST['userID']) : 0;
      $i0l11010=isset($_POST['gameID'])? preg_replace('/[^\d]/','',$_POST['gameID']) : 0;
      $i0l110101=isset($_POST['highscore'])? preg_replace('/[^\d]/','',$_POST['highscore']) : 0;
      $i0l1101010=isset($_POST['wpm'])? preg_replace('/[^\d]/','',$_POST['wpm']) : 0;
      $i0l11010101=isset($_POST['userStage'])? preg_replace('/[^\d]/','', $_POST['userStage']) : 0;
      $i0l110101010=isset($_POST['userSpeed'])? preg_replace('/[^\d]/','', $_POST['userSpeed']) : 0;
      $i0l1101010101=isset($_POST['userUnlocked'])? preg_replace('/[^\d]/','', $_POST['userUnlocked']) : 0;
      $i0l11010101010=isset($_POST['incrementLevel'])? preg_replace('/[^\d]/','', $_POST['incrementLevel']) : 0;
      $i0l110101010101=isset($_POST['wpmTarget'])? preg_replace('/[^\d]/','', $_POST['wpmTarget']) : 0;
      $il1l1l1010101011=isset($_POST['lettersTyped'])? preg_replace('/[^\d]/','', $_POST['lettersTyped']) : 0;
      $ill00=database::query("SELECT `nickname`,`grpname`,`stage`,`lvldata`,`maximum_score` FROM `ft_account_members` WHERE `uid`='$i0l1101'");
      while($ill001=mysql_fetch_array($ill00)) {
        $i00l1101010101010=$ill001['nickname'];
        $i00l11010101010101=$ill001['grpname'];
        $hlvldata=$ill001['lvldata'];
        $i00l110101010101=$ill001['maximum_score'];
      }
      $i1l01ll0= 'ft_64m3'.$i0l11010;
      $ill0010=database::query("SELECT `highscore` FROM `".$i1l01ll0."` WHERE `nickname`='$i00l1101010101010'");
      if(mysql_num_rows($ill0010)>0) {
        $ill00101=mysql_fetch_array($ill0010);
        if(mysql_error()=='') {
        }
        else { 
          echo mysql_error();
          exit();
        }
        ...
      }
    }
  }
}

Variables look generated, $i, $i1i, $i10 etc but then you look closer and realise some of 1’s are actually l’s, which conceivably could be generated, but then right in the middle is $hlvldata. Huh? either it has been obfuscated and the obfuscater is unbelievable or the variable names have been purposely chosen!

Ever heard of a loop?

So what do you do if you want to assign 32 variable names in ascending numerical order. Why you write it our 32 times of course, and of course you do this in at least 10 functions as well just for good measure.

$mpm->assign('gs0',$mp->get_game0score());
$mpm->assign('gs1',$mp->get_game1score());
$mpm->assign('gs2',$mp->get_game2score());
$mpm->assign('gs3',$mp->get_game3score());
$mpm->assign('gs4',$mp->get_game4score());
$mpm->assign('gs5',$mp->get_game5score());
$mpm->assign('gs6',$mp->get_game6score());
$mpm->assign('gs7',$mp->get_game7score());
$mpm->assign('gs8',$mp->get_game8score());
$mpm->assign('gs9',$mp->get_game9score());
$mpm->assign('gs10',$mp->get_game10score());
$mpm->assign('gs11',$mp->get_game11score());
$mpm->assign('gs12',$mp->get_game12score());
$mpm->assign('gs13',$mp->get_game13score());
$mpm->assign('gs14',$mp->get_game14score());
$mpm->assign('gs15',$mp->get_game15score());
$mpm->assign('gs16',$mp->get_game16score());
$mpm->assign('gs17',$mp->get_game17score());
$mpm->assign('gs18',$mp->get_game18score());
$mpm->assign('gs19',$mp->get_game19score());
$mpm->assign('gs20',$mp->get_game20score());
$mpm->assign('gs21',$mp->get_game21score());
$mpm->assign('gs22',$mp->get_game22score());
$mpm->assign('gs23',$mp->get_game23score());
$mpm->assign('gs24',$mp->get_game24score());
$mpm->assign('gs25',$mp->get_game25score());
$mpm->assign('gs26',$mp->get_game26score());
$mpm->assign('gs27',$mp->get_game27score());
$mpm->assign('gs28',$mp->get_game28score());
$mpm->assign('gs29',$mp->get_game29score());
$mpm->assign('gs30',$mp->get_game30score());
$mpm->assign('gs31',$mp->get_game31score());
$mpm->assign('gs32',$mp->get_game32score());

For the love of Deity man have you never heard of a loop? Perhaps he’d tried it as dynamic method calls and it didn’t work for him, oh wait no he’s already used a dynamic method call in another function, so that can’t be right.

Oh yeah and check out the variable names, no $iiii this time, and unbelievably where this is used multiple times the variable names are different, so it isn’t just a cut and paste jobbie???

Ever heard of date functions?

Damn you MySQL and your weirdly formatted dates, I don’t understand them, if only I could make them more friendly? I know I can split the date up and then change it – how could this be coded?

switch($hMonth) {
  case 1: 
    $hMonth='Jan';
    $hValue=1;
  break;
  case 2: 
    $hMonth='Feb';
    $hValue=2;
  break;
  case 3: 
    $hMonth='March';
    $hValue=3;
  break;
  case 4: 
    $hMonth= 'April';
    $hValue=4;
  break;
  case 5: 
    $hMonth='May';
    $hValue=5;
  break;
  case 6: 
    $hMonth='June';
    $hValue=6; 
  break;
  case 7: 
    $hMonth='July';
    $hValue=7;
  break;
  case 8: 
    $hMonth='Aug';
    $hValue=8;
  break;
  case 9: 
    $hMonth='Sep';
    $hValue=9;
  break;
  case 10: 
    $hMonth='Oct';
    $hValue=10;
  break;
  case 11: 
    $hMonth='Nov';
    $hValue=11;
  break;
  case 12: 
    $hMonth='Dec';
    $hValue=12;
  break;
}

Maybe its because he wanted to be as inconsistent with the date month display as he is with his variable names? There are so many shorter ways of doing this, let MySQL spit the date out in a correct format, use strtotime() coupled with date()? Argghh it hurts its too painful.

Ever heard of a sane data structure?

This last example takes the biscuit though. As far as I can tell what the coder wanted to do was store a set of 3 data points representing level scores. How did he choose to do this? in the date format 1_1.1_2.1_3.2_1.2_2.2_3….. thats right as a ‘.’ separated list with a ‘.’ set separator! How the hell would this be read in and updated… like this:

$a0=array("a00"=>array(
  0=>0,1=>0,2=>0,3=>0,4=>0,5=>0,6=>0,7=>0,8=>0,
  9=>0,10=>0,11=>0,12=>0,13=>0,14=>0,15=>0,16=>0,
  17=>0,18=>0,19=>0,20=>0,21=>0,22=>0,23=>0,24=>0,
  25=>0,26=>0,27=>0,28=>0,29=>0,30=>0,31=>0,32=>0
));
$a1=array("a11"=>array(
  0=>0,1=>0,2=>0,3=>0,4=>0,5=>0,6=>0,7=>0,8=>0,
  9=>0,10=>0,11=>0,12=>0,13=>0,14=>0,15=>0,16=>0,
  17=>0,18=>0,19=>0,20=>0,21=>0,22=>0,23=>0,24=>0,
  25=>0,26=>0,27=>0,28=>0,29=>0,30=>0,31=>0,32=>0
));
$a2=array("a22"=>array(
  0=>0,1=>0,2=>0,3=>0,4=>0,5=>0,6=>0,7=>0,8=>0,
  9=>0,10=>0,11=>0,12=>0,13=>0,14=>0,15=>0,16=>0,
  17=>0,18=>0,19=>0,20=>0,21=>0,22=>0,23=>0,24=>0,
  25=>0,26=>0,27=>0,28=>0,29=>0,30=>0,31=>0,32=>0
));

$hlvldataii=$hlvldata;
$hlvldatatok0=strtok($hlvldataii,".");
$hCntTok0=0;
$hCntTok1=0;

while($hlvldatatok0 !== false) {
  if($hCntTok1==0)$a0["a00"][$hCntTok0]=$hlvldatatok0;
  if($hCntTok1==1)$a1["a11"][$hCntTok0]=$hlvldatatok0;
  if($hCntTok1==2){
    $a2["a22"][$hCntTok0]=$hlvldatatok0;
    $hCntTok0++;
    $hCntTok1=0;
    $hlvldatatok0=strtok(".");
    continue;
  }
  $hlvldatatok0=strtok(".");
  $hCntTok1++;
}

$hlvl=$hCntTok0-1;
$hFlg=0;

for($i=0;$i<$user_stage;$i++) {
  $hlvlSrch.=$a0["a00"][$i].'.'.$a1["a11"][$i].'.'.$a2["a22"][$i].'.';
}

$hlvlSrch .= $user_stage.'.'.$wpm.'.'.$wpm_target;

I don't even know where to begin with this, have a go yourself, of course the variable names have been designed to help legibility. I wanted so badly to re-write it but in the end I opted to leave it as is and grab a beer.

Kill me now!

I could go on, these examples are just insane, the rest of the code is no better, if statements 20 levels deep, the same code repeated in a dozen functions, a single file with over 4000 lines of code. I can honestly say this is some of the worse code I've ever had the misfortune to work on.

Unfortunately I had to inform the client of how bad the code was, embarrassed at the level of incompetence displayed by my profession. Fortunately she was very understanding and guided by me has taken the wise decision to let me throw it away and start again. Hopefully a happy ending!!!

Facebook Send

In a recent post on the Facebook blog they announced updates to their group functionality, which currently isn’t really a function I use, although I can see the benefit of using groups. Buried near the bottom of the post and later picked up by Mashable was an announcement about a new piece of functionality not for the Facebook site but to be found on sites outside of Facebook.

In addition to the other new group features, we’re also introducing the Send button.

Similar to the “Like” button, it seems a “Send” button has been developed which can be placed on your site. At the moment it appears only on a small number of sites (about 50), but if it is successful on these sites I don’t see any reason why it wouldn’t be rolled out as a social plug-in in a similar fashion to the “Like” button.

This new functionality interests me for two reasons:-

  • Functionality such as this is abundant on sites and microsites in the form of a forward to a friend.
  • It further cements Facebook as a facilitator of communication.

Forward to a Friend

I’ve lost count of the times I’ve implemented this functionality on a site. Its not particularly challenging to implement functionally, but it is actually pretty hard to make it work well technically. Forget the fact that IMO this functionality rarely gets used, it is nevertheless added to so many sites alongside the almost equally as pointless share icons. What you don’t really tend to see is whether the form you submit ever actually ever reaches its recipient.

The reason for this is that web servers don’t make very good email servers. Sure it is easy to actually send email but to make it get to its destination is very unlikely to happen. The reason for this is that the email has to come from someone, usually the person filling out the form. When this email is sent the receiving server checks where the email has come from and if it isn’t from where the email domain should be coming from it is likely to mark it as spam.

The benefit of using Facebook for this is therefore two-fold, you reduce the implementation cost as it will essentially just be a quick plug-in, and you also increase the likelihood of it actually working! Whether it will actually be used is another thing entirely.

Facebook Replacing Email

Email is old, and if you believe some statistics 45% of all emails sent are spam. Communication has moved on considerably over the last few years and the one-size fits all solution which is email doesn’t really fit anymore.

Don’t believe me then I ask you when was the last time you tried to arrange something over email? And when was the last time you did it through Facebook, be it via an event of via FB message? Which was more successful? Our social worlds live on Facebook and for most people its just easier to communicate through Facebook than through email now, but only for this specific use-case.

Now I’m not suggesting that email will entirely be replaced, it use is so varied especially in business but you could say that it may be replaced for certain types of communication. Up until now the only Facebook mail has really only been used within Facebook, moving it into a wider context broadens the scope for its use, Forward to a Friend is just one use-case there may be many more for which Facebook may be a “better” solution than email.

Of course there is an argument that such an important channel should not be in the control of one corporation but I think we are far beyond the point where that argument is even relevant anymore, Facebook simply is the social channel.