All posts by Dan Sumption

Hypnagogic

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 safeatlast.org.UK

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…

www.justgiving.com/dansumption2

(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.

Fat

Following on from my posts about mindfulness and willpower, I promised I would write something about diet. Specifically about how I have managed to go from being a bit of a fat bastard, to a svelte hunk. Well, I started writing that blog post, and it got longer and longer, and people started asking me when I would put it online, and I started to have doubts about parts of it, to want to wrap everything in big, fluffy disclaimers. As the post started clump into subheadings, and as the contents under each heading got longer, I decided to split it into a series of posts. I will start now, by giving a little background, a personal history of me and fat.

For most of my life, I have been a skinny person. I’d always presumed that I would remain a skinny person. Weight/size was never an issue for me and, to be perfectly honest, I often felt a bit snooty about those for whom it was. Before my 30th birthday, I don’t think I could have told you quite how much I weighed – I probably only weighed myself once or twice in the previous ten years – but I’ve a feeling it fluctuated somewhere around the 8 or 9 stone mark (50-60kg). I’ve recently seen photos of myself from my early 20s and, believe me, I look like a famine victim.

This wasn’t down to any obsessive food-avoidance or anorexic/bulimic behaviour on my part. I could, and usually did, eat for England. Breakfast in those days would be one or two bowls of cereal, full to overflowing, ideally drenched with the cream off the top of the milk. For lunch, I would pop out of work and buy two packs of sandwiches, a large bag of crisps, a Belgian bun, and maybe an apple. And in the evening, whack a frozen pizza in the oven and, when it’s done, cover the top in a thick layer of mayonnaise and wolf the lot. And yet my weight never changed. Static. Skinny as a beanpole.

I don’t know entirely what happened when I hit 30, although I have some idea. I’m guessing that age and metabolism played some part in it, but also at that time my job changed radically, I started eating three course meals at restaurants every day, sometimes several times per day. I went from being happy with one or two glasses of wine per week, to drinking a bottle at lunch-time and another one or two in the evening. Yes, I think it was probably the wine that had the biggest effect; that, and the Jack Daniels and Cokes.

Suddenly I realised that I’d grown fat. My trousers didn’t fit me any more. My waist measurement had crept up from 32″ past 34″ and was now a 36″. In the course of two years, I’d gone from somewhere south of 10 stone, to a verging-on-the-obese 15 stone. In 2001, I briefly fought this trend – I used a month’s paternity leave as an opportunity to detox completely, and during that month of healthy eating and endless exercise I shrank back almost to 13 stone (83kg). But within another 6 months or so, all of that work was undone, and for the next 10 years I remained somewhere between fat and obese (although my height did a good job of hiding that from others), until at some point I realised that I’d hit 16 stone and Something Must Be Done.

That point was in 2009. Since then, I have done various things to try and control my weight. I’ve never let it become an obsession, but I have tried to maintain a downwards trend. I started off slowly, getting a little over a stone off in my first year, before slipping backwards a bit, and then attacking the problem more scientifically. Little by little (and occasionally a lot by a lot) I slimmed down until now I’m back to around 13 stone, with a body-shape I’m happy with, and a healthy BMI.

In my next post, I’ll talk about cycling (and walking, and other forms of exercise), how it helped kick-start my return to good health, and what it can and can’t do for fat bastards like the former me.

Willpower

Following on from the recent post on mindfulness, here’s another in my “self-help guru” (obviously I’m not) series. This time, I’m writing about willpower, based on the book Willpower: Rediscovering Our Greatest Strength (by Roy F. Baumeister and John Tierney) which I recently finished reading. I have some reservations about the book (see my Amazon review for details), but thought I’d share anyway, as it contains some very interesting findings which so far I have managed to put to good use.

The book makes the case for the fascinating theory of Ego Depletion (a theory which seems to be the baby of Baumeister and his collaborators). This states (more-or-less) that exercising willpower is tiring: if we exercise willpower over one part of our life, we may not have enough energy left to be strong-willed elsewhere. The book gives reams of scientific evidence to support this view, although I have since learned that this evidence is not quite so widely accepted as the authors would have you believe. Still: interesting, and possibly true. And, as the book rightly points out, willpower is one of the strongest predictors of happiness and success in an individual. So who wouldn’t want more of the stuff?

What practical lessons can we draw from this? Well, one is that we should conserve willpower for the times when we really need it. Choose your battles. But additionally, recognise scenarios which require mental strength and try to make them less challenging (mindfulness is a very useful tool for helping you to recognise which scenarios require more mental strength). I’m not just talking about epic battles of the will (although the book includes some interesting examples of these, including David Blaine, who can successfully will himself to go without food for 44 days when he chooses); as with mindfulness, drip drip drip, small changes can build into a mighty force, and if you can conserve a little willpower by simplifying small decisions then this may leave you with more oomph to handle the big stuff.

To give one example, summoning the mental strength to decide what to do in a given situation can be stressful; if you are able to plan that situation in advance, you remove the need to think about it at the time, and thus conserve a little willpower for other tasks. I’ll demonstrate how I’ve been using this in my own life: I have always resisted routine (and, as a result, am forever forgetting to brush my teeth – yeah, I know), but I have recently enforced a morning drill on myself. Get up. Go to the loo. Take my tablets & inhaler. Brush teeth (with my left hand – more about this below), shave (again, left hand), shower, weigh myself, get dressed, breakfast and a nice cup of tea, pack my bag and go out to work. All of these things. In that order. Every day. (Well, at weekends perhaps skip the work in favour of walking the dog). So far, so mundane. But the weird thing I’ve found is that following this regimented process leaves my brain so much freer to think about other things. I’m no longer worrying “did I forget to brush my teeth?”, and by the time I leave the house I feel completely set up for the day.

This also has big implications for dieting (of which, more in my next blog post). Well, firstly the book says that you shouldn’t diet, because the thing which (allegedly) gives you the energy required for willpower is glucose, blood sugar, and if you restrict your intake of food then you are apparently weakening your ability to say no. This makes it more likely that your diet will fail. But one strategy which proved successful in experiments was to lay out clear ground-rules for any troublesome situation before you encounter it. Don’t be unrealistic (in fact, you’re advised not to alter your normal habits by more than 20% if you want to be successful), so for example if you are going to a party don’t say “I won’t eat any of the food there”, but say “I will allow myself to eat one plateful of food, but no seconds”. Don’t say “I’m not going to drink”, but do say “for every two alcoholic drinks I will have a glass of water”. Ration your willpower and plan tricky decisions in advance, and you stand a better chance of success in the long run.

Finally, it is important that you learn to spot signs which indicate that your willpower is waning (again: mindfulness helps here). It turns out that one key sign is an increase in emotions – whether they be happy or sad; if you find yourself more tearful or ecstatic than usual, it could be that your blood sugar is running low (this got me onto thinking about bipolar disorder…). In fact, the book suggests that low blood-sugar is the cause of PMT: when much of a woman’s energy is devoted to her reproductive cycle and she may not have as much to spare for conscious decision making, and may crave quick energy-givers such as chocolate. And sleep is as important a component of willpower as glucose: if you feel tired, well then… you need more sleep. This sounds trite, but how many people these days actually bother paying attention to the signals that their bodies send out, rather than knock back another coffee or Red Bull. (It turns out that stimulants are not a great aid to willpower although, at least in the short term, sugary snacks are – inasmuch as they boost blood sugar levels and get more energy to the brain).

Oh, and that left-handed tooth-brushing and shaving? Well, one study demonstrated this was a way of increasing the “stamina” of our willpower. I took that with a pinch of salt but, what the hell, it’s got to be worth a try, right?

Mindfulness

A while ago, I posted a brief suggestion on how to be happier. Although I haven’t stuck religiously to my own advice (of finding some positives in each day), and there have been one or two times when my mood has dipped, life on the whole continues on an upwards trajectory. Particularly since Christmas I’ve felt fitter, healthier, happier and more productive. In the interests of sharing (and at the risk of painting myself as some sort of a self-help guru) I thought I’d list some techniques that I’ve been trying, and that are working for me. I will write separate posts on willpower and diet/exercise, but for now I will focus on the practice which I have found most useful: mindfulness.

What is mindfulness? Well, I guess you could just call it noticing things. Initially, noticing things about yourself – your breathing, body, mind and feelings – but ultimately mindfulness can be trained and expanded to help you be more aware of everything going on in the world and the people around you. I won’t go into a detailed explanation here of how to practice mindfulness (other than to say that the starting point involves meditation), because there are other resources listed below which do it far better than I could.

I first came into contact with mindfulness way back in 1989, when I was studying Psychology at university. Some of my fellow students got incredibly nervous about the coming exams, and as a result, one of the lecturers organised regular lunch-time workshops on relaxation and other coping techniques. I learned here that breathing deeply doesn’t mean breathing sharply, it means drawing the air all the way into your body; I learned how focusing on the breathing, and reciting simple mantras, can bring one’s mind back to rest from the hubbub of the everyday; and I learned that my own brain has the power to alter the temperature shown on a thermometer held in my fingers. Over the years I’ve drawn on these techniques to try and calm myself in times of stress, and to put the world in better perspective. More recently, the Sheffield Buddhist Centre (disclaimer: I am not a Buddhist) introduced me to the “mindfulness of breathing” meditation (and also the excellent “cultivation of loving kindness” meditation), and I realised that this practice was connected to the deep breathing I had learned years before in Bristol.

Since then, I have tried to find some time in my daily life for meditation; almost invariably I’ve failed. More recently still, Amazon sent me a book to review: The Mindful Manifesto, and it convinced me that, even if mindfulness is not the answer to every problem in the world, it’s a damn good alleviator of almost all of those problems (and, yes, there is scientific evidence backing this claim up in many fields – for example in one study, when people who had suffered three or more previous episodes of depression were given regular mindfulness exercises to carry out, their relapse rate was slashed from 66% to 37%).

But, finding a spare 20 minutes (which usually seems to be about the recommended length for a meditation) in my daily routine has proved impossible. 20 minutes doesn’t sound like much, but mornings are usually a more-or-less frantic dash to get to work in good time, lunch times are unpredictable, often brief (and anyway there is no suitable space at my work where I’d feel comfortable meditating). And evenings are already far too brief to fit in the bits of personal admin, book reading and socialising that I aim to do. So for months I was left high and dry with no meditatory outlets.

…until I decided to ignore the 20 minutes rule (which was never really a rule in the first place). At some point, I decided to give myself a goal of noticing my breathing at least once per day. Oh, and also of smiling and meaning it once per day. It seems like such a nothing of a goal that it oughtn’t to have any effect on life, but like the water dripping that eventually hollows out a cave or builds up a stalagmite, it has. I started by just pausing for a couple of slow, deep breaths while I was in bed in the morning. Then I started slotting additional breaths and smiles into the minute moments of downtime throughout my day: when stuck at traffic lights, waiting for a bus, or just standing for a moment to admire the scenery. And after just a few weeks, I can feel them solidifying into habits. In the meantime, I have also discovered the excellent Headspace website, which offers free 10 minute introductory guided meditations which you can listen to through your computer or phone, at your desk or on a bus. These have built powerfully on my little habit, and turned it into something which occasionally even makes me feel ecstatic, marvellously unburdened.

It’s still early days, but my meditation habit is growing step by tiny step, and daily I feel that my mood and my outlook on the world gets brighter and brighter. Meanwhile, I am working mindfulness into more and more areas of life – using it to keep me focused on my work, to prevent over-eating and drinking, and to be more present and empathic in my relationships with family and friends. I hope that you can find a spare two breaths in your every day to join me and be happy.

No Riot Here

Last night, I went for a cycle ride around the inner suburbs of Sheffield. On the way, I started tweeting about the everyday scenes I was seeing, and the fact that there were no riots, using the #noRiotsHere hashtag (I plucked the hashtag out of thin air: it turns out one of two people had used it earlier in the day, although not in Sheffield). You can see a collection of my evening’s cycling/noRiotHere tweets on Storify. Soon, other people started joining in, and by the time I got home #noRiotHere was trending in Sheffield.

A few people accused me of “trolling for riots” – most did it humorously, one or two seemed genuinely confused about what I was doing. So I’ll try to account for myself here…

First and foremost, I was going for a bike ride. It’s something I’ve done a lot recently (especially since getting my new bike), generally heading West from our house into the Peak District, the hills and moors around Strines and Bradfield. I’d already been considering taking a more urban ride, exploring some of the parts of Sheffield I hardly know, and I was running out of country lanes within easy cycling distance.

But I think what really galvanised me was the steady stream of rumours I’d been reading about incipient riots in Sheffield. As I follow a lot of people on Twitter and Facebook, and a majority of them are in Sheffield, I’d seen endless rumour and counter-rumour – in particular about civil disorder starting up on London Road. The excellent South Yorkshire Police twitter feed had been quashing these rumours all day, but I felt that some people would feel more reassured if they heard that someone they know had been there and reported back that all was peaceful.

And so I set off in the direction of London Road. My initial plan had just been to go there, check out the area, and then return home, but as I got closer my head started whirling with memories of other “riot-prone” areas people had been tweeting earlier, and as I felt like I could handle a much longer cycle ride, I decided to roam further afield. The idea for “#noRiotHere” literally came to me as I was cycling along (as is true of so many good ideas). I didn’t just want to give people the bare fact of “no riot here”, I wanted to emphasise the fact that normal things were going on, that people could and ought to make an evening of it, walk in the evening sunshine, go to the pub, treat it as a normal evening and not hide behind closed curtains. And so I started to tweet one mundane but beautiful thing that I saw in each suburb I passed through (admittedly I eventually started to tire of the mundane but beautiful, and resorted to the slightly comical instead).

I realised, of course, that to anyone outside Sheffield reading my updates, I could come across as insufferably smug; I thought (with apologies to all in London, Manchester, Birmingham, Nottingham, Leicester and elsewhere) that this was a price worth paying. Civic pride breeds more civic pride, and I thought it better to try instilling some of this before riots started. Last night’s #steelcitynotstealcity/#steelnotsteal hashtags did the same thing. To be honest, I thought there was already enough pride in this wonderful city to prevent people from smashing it up (particularly while the city’s youth are still basking in the memory of the incredible and inclusive Tramlines festival). But how to know what other people think? This week I’ve heard, via Twitter and Radio 5 Live, many cries of confusion and disbelief from residents of the riot-hit cities; how are we to know until something kicks off whether our civic pride that “Sheffield is different” is justified or just hubris?

And finally, I wasn’t trolling for riots, and was 95% certain I wouldn’t find any, but I was prepared – at least inasmuch as I had a fast bike, a mobile phone, and my wits about me. If I had stumbled on some disorder, I would have informed the police if necessary, informed Twitter whether necessary or not (it’d be stupid to deny that I’d feel the slightest bit smug for sharing the news before anyone else, massively outweighed of course by sadness at unrest in my home city), and a small part of me hopes that I might have been able to mobilise a public tut-mob early enough to shame potential rioters into going home. A stupidly vain fantasy, of course, but I think we should all be defined by our stupidly vein fantasies.

As it turned out, I had a lovely cycle ride, got to see parts of this beautiful city which are normally hidden to me (including the most amazing view from Gleadless), had a bit of fun along the way, and spawned an idea which was proudly reported on Radio Sheffield this morning. Sorry to be smug (and fingers crossed that this isn’t hubris), but it was a good night for Sheffield.