Tuesday 29 December 2009

Comments vs Readable Code

There is a widely contested mantra of Extreme Programming that says that comments are superfluous. Inaccurate and often out-of-date meta-information just makes your self-describing code and accompanying tests harder to read and understand.

However the opposite can seem to be true; how often do we try to decipher unpleasant code that has no comments because the mantra said that they were “evil”? It is dogma that leads to this problem.

It is important to remember that “no comments” is mantra not dogma.

Dogma is authoritative and not to be disputed, doubted or diverged from. That doesn’t sound at all agile to me. The word mantra originates in Sanskrit meaning “tool of thinking” or alternatively “liberation of thought”.

Dogma forces you to stick to practices that are believed to be good for you. Mantra can help you to re-evaluate your practices to find those that are actually good for you.

When you come to the point where you feel compelled to write a comment, think hard about whether or not it’s really necessary;

  • Could I convey this comment by renaming a method or variable to something meaningful?
  • Could the accompanying unit test describe the code better?

Can’t think of a good name for a class or method?

Okay, sometimes higher level architectural structures need to be documented, right?…

  • Maybe the class that manages the high-level architectural pattern could be better named?
  • Is a complex high-level architecture really giving you the required benefit if it is not easily understood?

Personally I cannot get to the end of these options without recognising ways of improving my code, although sometimes I’ve added comments to help me understand a large amount of ugly code, prior to refactoring.

The trick is to just keep thinking. Process is never an alternative to thought.

Tuesday 6 October 2009

ZX81 Sends an SMS

Our latest work project (video, voiceover and music by yours truly).

Monday 20 July 2009

Speed Camera Law Change

It’s interesting how government measures that seem extreme in the first place are often only the thin edge of the wedge. It’s particularly worrying when it concerns human rights, but it happens constantly and insidiously. Many pieces of freedom restricting legislation have been passed “to combat terrorism”, in fact they tend to have no effect on terrorism and end up being used to spy on school children or prejudice the law enforcement agencies against anyone who expresses a point of view.

The introduction of GATSO speed cameras seems to have been the thin edge of another wedge.

Speed cameras were introduced “to reduce the number of people killed or seriously injured in road collisions”. This sounds great, less people hurt or killed, who could complain?

In order to ensure that drivers slowed down, UK law stated that GATSOs should be painted a highly visible colour (reflective yellow). Drivers would see the camera in advance and gently slow down to the correct speed for the road. Even with this law in place, the cameras were often either carelessly or sneakily placed behind other signs or foliage, meaning that drivers would see them at the last minute and either get slapped with a hefty fine or slam on the breaks, hopefully not causing a crash in the process.

Do they want us to be going to fast through these “accident hot-spots” so that more revenue can be earned?

In April 2007, the law changed so that speed cameras no longer had to be brightly coloured, visible from 60 meters or sited only on accident black-spots. This will surely further reduce any effect they arguably had on road accidents in the first place.

Another more rational part of the law stops companies that set up cameras profiting from fines issued. This closes a loophole, making your local council the organisation that profits. At least then, the money raised will go back into the system and will hopefully end up being spent on improving roads.

The clear message from the government is “Speed Kills”. Of course what actually kills is irresponsible driving. I’m not advocating breaking the speed limit, but delegating the responsibility for policing road traffic law to cameras that only care about speed means that people will drive however they like as long as they don’t break the speed limit.

Thursday 9 April 2009

Rowridge Update

Seems I was a little hasty in demanding the head of light entertainment on a spike.

It turns out that the solution to the retuning of MythTV after the Rowridge frequency changes is to delete and recreate the entire Capture Card using mythtv-setup. I have done this and now all my channels work as they used to.

There must be some metadata that is incorrect for the new channel locations.

Thursday 26 March 2009

My Rowridge Freeview Settings

Here are my Freeview tunings as of 25 March 2009.

The following channels do not currently work

ITV 1, ITV 2, ITV 3, ITV 4, Channel 4, Channel 4 +1, E4, More 4, Setanta Sports 1, Heart (radio), Rabbit, Smile TV 2, Teletext

name mplexid serviceid
QVC 3 13120
4Music 6 25664
bid tv 3 14272
smileTV 5 22400
TOPUP Anytime4 6 27328
GEMSTV1 3 15840
SuperCasino 3 14560
NETPLAY TV 3 14432
CNN 3 15648
Russia Today 6 27456
Community 4 19968
Teachers TV 3 15808
Television X 3 15232
Teletext 2 8568
Rabbit 2 8634
TeletextCasino 3 16128
BBC Red Button 1 4479
Directgov 2 8576
301 4 19456
302 4 19520
303 4 19584
305 4 16768
BBC Radio 1 4 18496
BBC Radio 1 Xtra 4 18176
BBC Radio 2 4 18560
BBC Radio 3 4 18624
BBC Radio 4 4 18688
BBC Radio 5 Live 4 17920
BBC Radio 7 4 18112
BBC Asian Net 4 18240
BBC World Sv 4 18304
Ttext Holidays 3 14784
smileTV2 3 15712
1-2-1 Dating 3 14816
QUEST 3 14498
PARTYLAND 3 14368
SMOOTH RADIO 6 26368
Kerrang Radio 6 26304
talkSPORT 5 22592
Premier Radio 5 22976
Absolute Radio 5 23104
Heart 2 8772
The Hits Radio 6 26560
Magic 6 26624
Q Radio 6 26688
heat 6 26240
Gems TV 6 27200
Lottery Xtra 6 27264
Sky Text 5 23680
Setanta Sports 1 3 16096
Virgin1 6 25856
BBC FOUR 4 16832
BBC THREE 1 4351
BBC Radio 6 Music 4 18048
BBC Radio 5 Live Sports Extra 4 17984
CBBC Channel 1 4671
CBeebies 4 16960
Channel 4 2 8384
Five 3 12866
CITV 3 16032
Dave 5 22272
E4 2 8448
Film4 6 27136
Fiver 3 12928
Yesterday 6 25792
Ideal World 6 25920
ITV2 2 8325
ITV3 2 8294
ITV4 2 8353
Kiss 6 26176
ITV1 2 8270
More 4 2 8442
BBC NEWS 24 1 4415
Sky Sports News 5 22144
BBC Parliament 4 17024
Channel 4 +1 2 8452
Dave ja vu 6 27392
E4+1 5 22336
ITV2 +1 6 27072
Sky News 5 22080
Sky3 5 22208
Smash Hits 3 14592
BBC ONE 1 4163
BBC TWO 1 4227
TMF 6 25728
Five USA 3 12992

More on Rowridge Retune Nightmare

Looks like a lot of people have complained about losing channels. Apparently so far about 1% of the 500,000 households have called the helpline.

Friends of mine have had similar issues. One lives close to me and lost the same set of ITV related channels. Another lives near Salisbury (further from the transmitter) and has lost all channels except CBeebies!

I imagine a lot of people (like us) haven’t complained yet, in the hope that service will get better by the weekend. We need to get as many people as possible calling in, as they don’t seem to think there’s a real problem!

Here are my current channel settings, as requested by Ade, in case anyone wants to check their MythTV settings.

Wednesday 25 March 2009

Rowridge Retune

Notification of the changing of frequencies for Freeview channels broadcast from the Rowridge transmitter on the Isle of Wight came through a few weeks back.

I think I’ve picked up all the usual channels, but initial results in Poole are poor…

Not working:

  • ITV 1
  • ITV 2
  • ITV 3
  • ITV 4
  • Channel 4
  • Channel 4 +1
  • E4
  • More 4
  • Setanta Sports 1
  • Heart (radio)
  • Rabbit
  • Smile TV 2
  • Teletext

All the other channels (at least those that are broadcasting at midnight) seem to be alright. I could have quite happily done without “Premier Christian Radio” or “Teletext 1-2-1 Dating”, but all the ITV channels?!

Hopefully they’ll sort this out soon and restore the good reception I’ve been enjoying for the last few years.

Friday 20 February 2009

Update

Been a bit busy, so haven’t posted since last year. Here’s what’s been happening.

  • Christmas at home with the family – peaceful.
  • Got married on the fifth of January – in a castle.
  • Honeymooned in South Africa for four weeks – sunny.
  • Started using Twitter in earnest – tweety.
  • Got home just in time to go from 37 Celcius to -10 – snowy.
  • Blew up my home router by changing a big lightbulb – grrr.
  • Spent a week trying to get new router to do stuff – frustrating.
  • Made a video of our new Google Android OMA configuration code – geeky.

Right now we’re up to date, I’ll try to continue blogging properly again.