Comments vs Readable Code

Posted by Kat Crichton Tue, 29 Dec 2009 16:51:00 GMT

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.

Posted in  | 1 comment

ZX81 Sends an SMS

Posted by Kat Crichton Tue, 06 Oct 2009 07:44:00 GMT

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

Posted in  | Tags , ,  | 1 comment

Speed Camera Law Change

Posted by Kat Crichton Mon, 20 Jul 2009 12:54:00 GMT

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.

Tags , ,  | no comments

Rowridge Update

Posted by Kat Crichton Thu, 09 Apr 2009 08:58:00 GMT

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.

Posted in ,  | no comments

More on Rowridge Retune Nightmare

Posted by Kat Crichton Thu, 26 Mar 2009 21:53:00 GMT

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.

Posted in  | no comments

Rowridge Retune

Posted by Kat Crichton Wed, 25 Mar 2009 23:26:00 GMT

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.

Posted in  | 12 comments

Update

Posted by Kat Crichton Fri, 20 Feb 2009 17:15:00 GMT

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.

no comments

Fedora 10 PackageKit Problems

Posted by Kat Crichton Wed, 10 Dec 2008 23:23:00 GMT

I’d been using the Smart Package Manager instead of the standard Fedora/RedHat offerings for the last couple of years, as it seemed to do a better job of sorting out RPM dependancy problems.

However, on installation of Fedora 10, I thought I’d give PackageKit a try. It had been running nicely for two and a half weeks when an update caused any PackageKit use (even searching) to throw errors like this…

failed to get a TID: A security policy in place prevents this sender from sending this message to this recipient, see message bus configuration file...

There is a long thread on Fedora Forum about it, but after some hacking about and a general failure to get it sorted, I’ve decided to put Smart back on.

This went without hitch and in the process, I created some Smart channel files for RPM Fusion, the new third party software repository that merges Dribble, Freshrpms and Livna.

rpmfusion-smart-channels.tar.gz (864 Bytes)

Just put the .channel files in /etc/smart/channels/ and Smart-GUI will pick them up.

Posted in  | no comments

IPCop Firewall

Posted by Kat Crichton Tue, 23 Sep 2008 08:42:00 GMT

I originally set up a Fedora 5 Linux box which worked reasonably well. I had some traffic shaping and a limited number of ports open. However it was getting out of date (we’re now on Fedora 9) and I heard good things on the Ubuntu UK Podcast about IPCop, a firewall-only Linux distro.

I have now installed IPCop. It does have some security improvements over my existing set-up, although it doesn’t double-up very well as a mini server since it only includes the parts of the OS required for a Firewall. I think I’ll have to move my Subversion server onto my MythTV box which is always on – although I’m now tempted to give GIT a try, which I’ve also heard good things about.

I think I may have another issue which is muddying the waters as far as my firewall goes. Previously I had very bad connectivity with the old firewall, which went away after a few weeks. When I first set up the new IPCop firewall, I had the same problem, which now seems to have gone away too. It may be just freak network traffic. It may be I have a dodgy network adaptor in the machine (one of the four). More research is required…

Posted in  | Tags  | no comments

Elonex WebBook Ultra-portable

Posted by Kat Crichton Mon, 22 Sep 2008 13:37:00 GMT

I just bought an Ubuntu based Elonex WebBook from Carphone Warehouse. It costs £239 (although it was listed on many review sites at £219), or comes free with a £25/month Orange mobile broadband package.

Vodafone offer an identical mobile broadband package for £15/month, so the “free” cost of the laptop is £360 even if you do cancel the contract after the obligatory 24 months.

Elonex WebBook open

The DVD has been placed to show scale. The WebBook does not have a CD/DVD drive. As yet there is no official way to backup or restore the OS. Apparently details will be posted on the Web soon.

The Linux version has the best price and performance. It’s a full blown Ubuntu distro rather than a cut down OS as found on other ultra-portables like the Eee PC. It’s great to see that all power-saving and wireless options work as they should, although it seems not to support Bluetooth in spite of the presence of a button on the keyboard. I’m not sure if this is a compatibility issue or just an absence of Bluetooth hardware!

Elonex WebBook closed

I bought the iPod-like white model (black also available).

Three USB ports and an SD/MMC card make this usable as a photography off-line storage and manipulation tool.

Memory is a little low (512MB), but email, web browsing and document creation don’t seem to suffer at all. It only has one memory slot, so upgrading will involve throwing some memory away – not a major concern when it only costs about £20 a gig!

The keyboard has reasonably sized keys and is usable for touch-typing. The Function button (annoyingly where the control key should be) gives access to a shared numeric keypad and hardware control keys for paging, screen brightness, volume and wireless. The mouse pad works well and provides scroll-wheel functionality when its right side is stroked.

The machine is pre-installed with Open Office, Evolution for email/calender, the GIMP, some educational software, Wine (for Windows compatibility) and lots more. Being Linux, this only takes up about 2GB of the 80GB drive, so you’ll have plenty of space left for other applications and data.

Elonex WebBook front open

The Screen is bright and clear and just about manages full screen video playback (depending on codec) once you configure the player to use X11 video rather than XV. This seems a bit of an oversight as, out of the box, most video playback will show as a black screen! Flash installed seamlessly and played back youtube videos with ease

Overall, this is a really useful ultra-portable at a great price. Highly recommended!

Posted in  | Tags , ,  | no comments

Older posts: 1 2 3 ... 7