Functional JavaScript

Two or three years ago, my polyglot colleague Dave Spanton persuaded me to try functional programming. I took a few basic Haskell tutorials, but went no further. I got the sense that there was a far deeper seam there which I really needed to dig into, but time, and the pressures of work, gradually drove the need out of my mind.

In the last couple of weeks, I finally made time to go deeper. And I did so by taking the Hardcore Functional Programming: Advanced JavaScript Coding course, by Joe Nelson and Brian Lonsdorf, on Udemy (Udemy had one of their sales on — I swear they have more sales than DFS — and so I picked the course up for just £12, rather than the £78 advertised).
Continue reading Functional JavaScript

I’m Back

When I started this blog, back in February 2001, its title meant something: Life – because it was a journal of mine – and Less Literary – because I didn’t want anything on it to be over-thought, over-worked. This was a very deliberate strategy, prompted by the fact that I’d spent the last couple of years intending to put more writing online, but was stymied by my own perfectionism.

In those early days the volume of stuff I wrote on here was, with hindsight, phenomenal. Often several posts per day, some of them surprisingly lengthy. I quickly built up an archive of stuff on diverse topics than in later years became the stuff of legend and mockery. I migrated from Blogger to some-other-platform-whose-name-I-forgot to WordPress, and moved servers at least a couple of times. I added various templates and plugins, most of which have died in some way or other over the years (any WordPress experts out there fancy helping me with some housekeeping?) And gradually, year by year, my written output slowed down. Until we reach the present day, where it seems hard for me to scrape together even one post per year – and even then it’s usually when someone dies.

Then last night, in a beer-fuelled conversation with Si Wilson and Emma Jane Hogbin Westby somebody suggested that I write blog posts to help firm up my thinking on technical topics. Which is something I’ve been meaning to do for yonks but, yeah, perfectionism. And then I was reminded of the original purpose of this blog, of the title of the bloody thing, and I thought “fuck it. It’s time to get less literary again”.

And so, here I go, again. I hope this will be the start of a renaissance of less-literaryism. I would love to post here every day, but I suspect that a couple of times per week would be a more realistic target. Please harass me if I don’t. The contents will be a little more technical than in the past (funnily enough, for somebody who has worked mainly as a developer for the last 20 years, I’ve managed to maintain this blog for 14 of those years with a surprisingly low level of pollution from overly-dry code samples and technical arguments; it was too good to last). But there will still be plenty of random shit. Enough, I hope, that I will be able to look back in ten years’ time and say, in response to a discussion on any topic under the sun, “oh, I wrote a blog post about that in 2015”.

Airbnb holiday apartment rental in Sheffield

We now have a lovely, newly decorated hip, modern studio-flat, attached to our house, which is listed as a rental apartment on Airbnb. If you’re interested in visiting Sheffield, and you find the listing via my blog, then you can have a 15% discount on your stay: just send me an enquiry on Airbnb via the link below, stating that you arrived there from

Studio flat S10 close to university – Flats for Rent in Sheffield

Apartment in Sheffield, United Kingdom. Our recently converted mezzanine studio flat is attached to our home, but with its own private entrance. 20 minutes walk from the city centre, and with the Peak District also within walking distance, it's a perfect base for all sorts of adventures… View all listings in Sheffield

We have already welcomed a host of lovely people from as far afield as the USA, China, India and Kuwait, visiting Sheffield for weddings, graduations, music festivals, catching up with old friends or just for a city break. Every one has been a pleasure. We try to make your stay in Sheffield a little bit special by providing you with artisan bread, jam and butter, a selection of books we have loved, and advice and recommendations for restaurants and places of interest in Sheffield, plus walks both in the city and in the beautiful surrounding Peak District.


hyp·na·go·gic adjective

Of, relating to, or occurring in the period of drowsiness immediately preceding sleep. hypnagogic hallucinations.

I remember a couple of occasions in my life when I went to bed early, listening to the radio, and soon found myself floating in some sort of a reverie, conscious yet not quite awake, entranced by music more beautiful than I had ever thought possible.

With that in mind, I have put together a playlist of hypnagogic tunes on Spotify. Put it on by your bedside before you go to sleep. Perhaps put it on loop. I can’t promise you that magical, lucid feeling, but I do hope that your dreams will prove interesting.

TDD: When Not To Unit Test

Often when I speak to development teams about their technical debt, one of the issues they highlight is lack of unit test coverage. “We only have 30% coverage, so we’re hoping to set aside some time next sprint to get more tests in place. Our latest work all has 100% coverage, but there’s a lot of code from way-back-when which is completely lacking in tests”.

This seems to me to misunderstand the purpose of unit testing. I can see how this misunderstanding comes about: there is a general acceptance that tests are good, and that a high level of test coverage is good, therefore increasing coverage must be a worthwhile thing. Right?
Continue reading TDD: When Not To Unit Test

Just Giving

No doubt you’ve noticed me spamming you these last few days with links to my charity fundraising page. This will be the last time, please read it…

If you’re anything like me, you may well be thinking “yeah, yeah, doing something that you enjoy & would probably have done anyway, then claiming some noble cause for it. I’m not falling for that”.

In a way, you’d be right. This has been an amazing experience for me, and one that I’m really glad to have had. And I could probably have found ways to raise the money that would involve me having slightly less fun.

But the end result has been that, through persuading and cajoling and haranguing, I (or rather you) have raised almost £1700 for one amazing charity. And that’s ALL for the charity: this isn’t one of those jollies where the cost of the trip comes out of the amount raised; I have paid my way in hotel bills and ferry fares, and right down to the energy bars & support van costs.

I URGE you to take a quick look at my chosen charity, and the amazing work they do – including running the UKs only refuge for young people under 16, by visiting their website at

And, if you can afford anything more to support this valuable work, even if it’s only a quid, then please help me end this weekend with a bang by donating on my justgiving page, or by texting “DANS95 £1″ to 70070. You know, we’re not all that far off raising £2000 together right now…

(Please share, if you feel so inclined)

Reading Fast and Slow

I’m currently reading a book by the psychologist Daniel Kahneman, called Thinking Fast and Slow. Kahneman has been something of a hero of mine for over twenty years, since I first came across his work during my psychlogy degree at Bristol University. The papers that he authored (along with Amos Tversky) on heuristics and biases provide a fascinating and ever-relevant insight into how humans make simple and predictable mistakes because of the way that their minds work; and, again because of the nature of human cognition, we generally don’t realise when we have made these errors of judgement; we will defend our incorrect way of seeing things because we are quite simply blind to our own biases.

Kahneman’s book is, as the title hints, about two types of thinking: fast, or “System 1″, happens automatically and effectively without any effort on our own part: if I ask you what the capital of France is, you don’t have to dig deep within your mind to pull out an answer (in fact, you will find that it requires more effort not to think of Paris). Slow, or “System 2″ thinking, requires conscious effort, to fetch pieces of knowledge and hold them in your mind while you perform operations upon them. For example, if I asked you to estimate the distance between the capitals of France and Germany then you would probably conjure up a mental map of Europe, locate those two cities on it, and hold all of this in your mind while you make a guess at the distance between them.

There is much evidence that we are “lazy” thinkers, with limited mental energy available to us, and if we can avoid using System 2 thinking then we will do so. As we get better at performing any task – for example riding a bike – the steps required to do so are packaged up in a way that makes them accessible to System 1 thinking, and we become able to perform that task “without thinking”, or at least without being conscious of thinking.

…and this got me thinking. On the back of the book is a quote from Richard Thaler: “Buy it fast. Read it slowly”. Well, that stuck in my mind, and I did make an effort to read the book slowly, to linger and let its revelations sink in. But, as with almost any book I read nowadays, from time-to-time I found myself reaching the end of a paragraph with scarcely any idea of what I had just read. So I had to go back and re-read it, forcing myself to slow down and pay attention. And this is when my learnings from the book imposed themselves on my experience of reading the book: I realised that I had slipped between System 2 reading (slow, methodical, effortful and attentive) and System 1 reading (speedily going through the motions of regognising each word, but without that same experience of the meaning sinking in). This happens to me so much recently that I often wonder what has happened to my reading ability: I’m sure reading never used to be this difficult or unproductive when I was younger. But Kahneman has made guess at what, perhaps, my problem is: that I have become too good at reading, it has become an automatic System 1 process, whereas reading and comprehending is something which always needs to be carried out by System 2. This is a somewhat counter-intuitive conclusion – that becoming better at reading makes us in some ways worse at reading – although since reading is a relatively recent invention and not something that we human organisms have evolved to do then there is little reason why this should not be so. And I do not have any easy solutions – I suppose that it would be possible to somehow introduce disruptions into one’s readings and so, by making it harder, force us back into using System 2. If anyone has any other suggestions on how to remain attentive while reading then I would welcome them.