JavaScript gotcha: var scope

I have been using JavaScript for more than 15 years with some projects running to several thousand lines.  But just discovered that for all these years I have misunderstood the scope rules for variables.  I had assumed they were block scoped, but in fact every variable is effectively declared at the beginning of the function.

So if you write:

function f() {
    for( var i=0; i<10; i++ ){
        var i_squared = i * i;
        // more stuff ...
    }
}

This is treated as if you had written:

function f() {
    var i, i_squared
    for( i=0; i<10; i++ ){
         i_squared = i * i;
         // more stuff ...
    }
}

The Mozilla Developer Network describes the basic principle in detail, however, does not include any examples with inner blocks like this.

So, there is effectively a single variable that gets reused every time round the loop.  Given you do the iterations one after another this is perfectly fine … until you need a closure.

I had a simple for loop:

function f(items)
    for( var ix in items ){
        var item = items[ix];
        var value = get_value(item)
        do_something(item,value);
    }
}

This all worked well until I needed to get the value asynchronously (AJAX call) and so turned get_value into an asynchronous function:

get_value_async(item,callback)

which fetches the value and then calls callback(value) when it is ready.

The loop was then changed to

function f(items)
    for( var ix in items ){
        var item = items[ix];
        get_value_async( item, function(value) {
                                do_something(item,value);
                          }; );
    }
}

I had assumed that ‘item’ in each callback closure would be bound to the value for the particular iteration of the loop, but in fact the effective code is:

function f(items)
    var ix, item;
    for( ix in items ){
        item = items[ix];
        get_value_async( item, function(value) {
                                do_something(item,value);
                          }; );
    }
}

So all the callbacks point to the same ‘item’, which ends up as the one from the last iteration.  In this case the code is updating an onscreen menu, so only the last item got updated!

JavaScript 1.7 and ECMAScript 6 have a new ‘let’ keyword, which has precisely the semantics that I have always thought ‘var’ had, but does not seem to widely available yet in browsers.

As a workaround I have used the slightly hacky looking:

function f(items)
    for( var ix in items ){
        (function() {
            var item = items[ix];
            get_value_async( item, function(value) {
                                    do_something(item,value);
                              }; );
        })();
    }
}

The anonymous function immediately inside the for loop is simply there to create scope for the item variable, and effectively means there is a fresh variable to be bound to the innermost function.

It works, but you do need to be confident with anonymous functions!

Christmas and the Foundational Myths of Social-Anthropology

Unwrapping Christmas (cover)I have started to read “Unwrapping Christmas” (David Miller ed.) a collection about the modern celebration of Christmas from an anthropological and sociological perspective.

So far I have read just the first two chapters: an attempt to synthesise ‘A Theory of Christmas‘ by Miller and a translation of Lévi-Strauss’ 1952 article on ‘Father Christmas Executed‘ (Le Père Noël supplicié).  These have been fascinating both in their intentional insights into Christmas, but also their unintentional insight into mindset of social-anthropology, the foundational myths of the area

I came across the book as it was mentioned in an article I was reviewing and I realised it is something I should have read years ago when I was first writing about virtual Christmas crackers many years ago1.

It was published in 1993, and both Christmas, as a global festival, and anthropology/sociology have developed since then, so in some ways a snapshot from 20 years ago.  It would, not least, be interesting to see an update on post-9/11 Christmas in Islamic countries

Miller starts his investigation into a ‘theory’ of Christmas by noting that anthropologists take a largely ‘synchronic’ view of phenomena, “detailed observations of current practices” as opposed to folklore research, which is more focused on “survivals”.  However, despite this, he allows himself an historical detour.

He starts, as is traditional, with the Roman midwinter festivals.  However, I had not realised that there were several of these, deriving it appears (based a little wider reading, not Miller) from a variety of different pre-Roman, midwinter traditions possibly dating back to Babylonian times.  First there was Kalends2, which was known for present giving, unusual, freedoms for slave and child, and holding lightly to money.  Second, there was Saturnalia, a period of feasting and gluttony, which even in Roman times was seen as “crass materialism”.  Finally, there is the latecomer Dies Natalis Solis Invicti, the Sun God’s feast, set on 25th December.

The last is the reason I have always heard for the choice of the date of Christmas, a deliberate borrowing of a popular pagan festival, and then ‘Christianising’ it in the same way that many churches were built on pagan religious sites.  Except, when I started to look a little more deeply at this, I found that this account, that I had always heard, is now challenged, by a more modern account based on the earlier supposed date of conception of Jesus (the Annunciation)3.

The evidence for either derivation appears at best circumstantial and partial, and whether or not Christmas was deliberately dated to coincide with these pagan festivals, the driving force of midwinter festivals, the need for consolation in darkness and the hope of new light, is undoubtedly also one of the reasons for the ongoing popularity of Christmas.  Furthermore, it is undoubtedly the case that many rituals connected with the Christian Christmas, such as the Christmas tree, are deliberate or accidental adoptions of pre-Christian symbolism.

However, the origins and strength of the academic myth of the pagan date of Christmas, whether or not it turns out to be true, is an interesting story in itself.  It appears to have arisen in the 18th and 19th centuries.  During this time and running into the early years of the 20th century, there was a popularity for studies of folklore and myth to seek syncretic origins, to see common underlying mythic stories across all cultures. I guess Freud and Jung can be seen as part of the tail-end of this tradition.

This can be seen as a modernist agenda, albeit with a slight trace of the Victorian love of occult, seeking singular causes, and seeing all ancient accounts as not just mythic, but entirely fictional.  This hyper-scepticism was severely challenged by Calvert and Schliemann’s discovery of Troy in the 1860s4, which had been believed to be purely mythical.  Now-a-days historians take a critical but more open-minded approach to documentary evidence, but the remnants of Victorian hyper-scepticism were still evident in Biblical scholarship, certainly until the late 20th century.

Miller ends up with a two-stranded theory.

One strand is externally focused on the carnival aspects of Christmas as a way to connect to a wider world, and through a temporary overturning of order with (almost Easter-like, but to my mind stretched) echoes of the killing and renewal of the Lord of Misrule.  A more cynical view of carnival, might be of a periodically sanctioned inversion of establishment, in order to channel and control dissent.  However, Miller offers a more generous life affirming view.

The second strand is internally focused on family, and in particular the nuclear family.  Miller sees this as a response to society under threat; in modern times in response to “the threat posed by the sheer scale of materialism“.  That is, if I have understood right, Christmas as reaction against, rather than slave to, market culture.

As an investigation of the global secular Christmas, the account makes virtually no reference to religious origins of Christmas.  Indeed, the desire to distance itself from Christian theology and symbolism is sometimes arcane.  At one point Miller suggests that:

“The birth (sic) of Christmas is itself an attempt to anthropomorphize the divinity in the form of the domestic family unit …”

This is stated with no reference to incarnation, or the origins of the early celebration of Christmas when theology of Christ’s humanity and divinity were being contested.  I could not decide whether this was deliberate irony or culpable ignorance.

The relation between Christmas as religious rite and secular festival is not only problematic for the anthropologist.  Church writers decried the intemperate and potentially licentious festivities throughout the first millennium, and Christmas was banned entirely in Puritan England.  Within living memory, Christmas Day was a normal working day in the Calvinist Protestant areas of Scotland, and in the 1970s there was a campaign to “put Christ back in Christmas“, not least in reaction to the growing use of ‘Xmas’.  Many Christians find the figure of Father Christmas problematic.  At the very best there is a fear of confusing children, captured perfectly in ELP’s  “I believe in Father Christmas“:

They sold me a dream of Christmas
They sold me a Silent Night
And they told me a fairy story
‘Till I believed in the Israelite
And I believed in Father Christmas
And I looked to the sky with excited eyes
‘Till I woke with a yawn in the first light of dawn
And I saw him and through his disguise

At worst Father Christmas, often with attendant fairies and pixies, is seen as verging on the demonic.

Conflict between secular and religious Christmas seems particularly strong in the US with, it appears from this side of the Atlantic, endless tales of cribs or Christmas trees being banned from schools or public places for fear of hurting the feelings of other religions (which almost universally seem to reject any problems), not to mention the anodyne ‘Happy Holidays’.  However, similar stories hit the news in the UK also, with one Vicar suffering the ire of the national media for telling school children about the (somewhat gruesome) historic origins of Saint Nicholas, and in so doing undermining their faith in Father Christmas5:

“… horrified parents said the talk would give their children nightmares and make them start to disbelieve in the magic of Father Christmas and his reindeer.”

Lévi-Strauss’ ‘Father Christmas Executed‘ picks up precisely one such point of Christmas conflict in Dijon in 1951, when the local clergy publically burnt an effigy of Father Christmas.  It appears, from the France-soir report that Lévi-Strauss quotes, that the children actively took part in this mock execution, so maybe French children in the 1950s were made of stronger stuff that UK children today. Naughtily, I cannot but help think that the Dijon clergy may  have unwittingly captured the neo-pagan spirit of the burning of wicker men.   Certainly the France-soir reporter saw some of the irony of the situation noting that, “Dijon awaits the resurrection of Father Christmas“, who was to speak from the Town Hall roof later that evening.

Writing in 1952 Lévi-Strauss is fascinated by the ostensive rejection of American culture and values in France, and yet the speed at which American Christmas had infiltrated French nativity.  He attributes this to ‘stimulus diffusion’, where the external system (American Christmas) evokes pre-existing ideas or needs.

He makes excursions across various related beliefs and ceremonies, including, inevitably, Saturnalia, but also, in passing, mentioning the display of antlers in Renaissance Christmas dances, prefiguring Santa’s reindeer (Herne and the Wild Hunt transfigured to Rudolph with his nose so bright).  However, eventually settles that the “beliefs linked to Father Christmas relate to the sociology of initiation (and that is beyond doubt)“, based partly on practices of Pueblo Indians placating the spirits of past dead children by giving gifts to their own live children, the lessons from which “can be extended to all initiation rites and even all occasions when society is divided into two groups.” — well, of course.

As an example of a literature-based study of homo anthropologist, I found the following statement particularly fascinating:

“Explanations in terms of survivals are always inadequate. Customs neither disappear nor survive without reason.  When they do survive, the reason is less likely to be found in the vagaries of history than in the permanence of a function which analysing the present allows us to discover.”

The discussion of the Pueblo Indians is deemed powerful precisely because there are no historical connections and therefore any (strained) parallel is connected to deep underlying human needs and aspirations, the “most general conditions of social life.”

Ignoring the validity of the analysis of Christmas, itself, one cannot help but see the parallels with the Victorian folklorists desire for deep universal structures.  Of course, here there are, in addition, historical cultural connections within academia, but also this desire for the singular casual explanation is surely one of the “general conditions of academic life.”

As mentioned, writing in 1993, 40 years after 1952 Lévi-Strauss’ article, Miller starts by noting a ‘synchronic’ focus of anthropologists, and in the list of contributors Lévi-Strauss is described (and undoubtedly was) “the most distinguished anthropologist of his generation“.

It almost feels as though the quote from Lévi-Strauss is a statement of a foundational myth of the discipline.

The statement is not absolutist, indeed in ‘Father Christmas Executed‘ Lévi-Strauss triangulates his synchronic analysis of Christmas with a diachronic excursion into Abbé de Liesssse, Julebok and the Lord of Misrule amongst others.  However, note the emphasis  of the statement, “less likely to be found in the vagaries of history than in the permanence of a function“, gives a primacy to ahistorical accounts.

Ethnography developed as a recording of people’s behaviours and customs without imposing external values or systems of thought, the cultural equivalent of a physical observation, but with the understanding that the observer needs to get inside the subjective experience of the participants.  This methodological focus has perhaps transposed into an ontological one, the importance methodologically of focusing on the present, becoming a primacy of the present, the avoidance of external value systems tainting historical analysis.

Maybe the field has also been wary of ubiquitous historical determinacy such as colonial accounts of the inevitability and superiority of 19th century civilisation, Marxist belief in its inevitable downfall, or the more recent narratives of western democracy.

However as rhetoric, this ahistorical focus feels rather like pre-ecological biology.  A simple view has animals evolving to fit into environmental niches, just as Lévi-Strauss sees American Christmas ideas finding a place in a French cultural niche.  However, biological systems are now seen as reflexive, co-evolutionary, the environment is shaped by the species just as the species is shaped by the environment.

This is a less comfortable and less stable world that challenges the enduring Darwinian myth of optimality.  Species (including humans) are no longer the best possible creatures for their environment but historically contingent and part of an ongoing dynamic.

Similarly cultural practices do not simply sit upon universal human and social functions as a singular causation, but those functions, the underlying human needs, change due to the practices in which we as individuals and as societies engage.

Adoration of the Shepherds by Gerard van Honthorst The weakness of ignoring this can be seen in Miller’s view of Christmas in relation to the nuclear family.  To the early readers of Matthew and Luke’s gospels, the story of the woman giving birth away from extended family must surely have been strange if not shocking.  Indeed early icongraphy is much more focused on mother and child than the classic modern family crib scene (although both are found, and the history of woodworking tools is indebted to depictions of Joseph the carpenter).

However, if we imagine recently industrialised and urbanised 19th century Britain, with extended family often far away in the country, or recent migrants or settlers in the US, the non-traditional nativity scene must surely have framed and helped build the very notion of nuclear family.  This is particularly obvious in the account of Christmas in Laura Ingalls Wilder’s “Little House on the Prairie“.

Similarly, is the global popularity of Christmas also in part due to the 18th and 19th century combination of colonisation and missionary movements that helped establish globally what we now deem to be ‘universal’ ideas of ethics and rights; ideas, of course, derived in no small part from the Christmas story?  Although, in their part, these ideas maybe had impact precisely because they touched universal needs in the human heart.

  1. To try out virtual crackers go to vfridge.com/crackers/, to read about them see my chapter “Deconstructing Experience – pulling crackers apart”  or shorter Interactions article “Taking fun seriously“.[back]
  2. Strictly, Kalends were the end of any month, but there appeared to be particular celebrations at the end of December.[back]
  3. For more discussion of the date of Christmas see The Date of Christmas and Epiphany and Catholic Encyclopedia: Christmas.[back]
  4. The Wikipedia page on Troy describes the early archaeology, but not the previous scepticism, which is in more detailed accounts. [back]
  5. Vicar tells primary school children Santa Claus is NOT REAL and reveals gruesome legend.  Express, 12 Dec 2013. [back]

A sleepless night; do you have a b**ping mobile phone?

There are many reasons to swear at your mobile phone.  I’ll talk about just one.

I have just had a sleepless night.

I was staying in an Oban hotel and needed to get up at 5:45am for the Tiree ferry.  I went to bed early, but not too early, intending to get a good night’s sleep before the early start.  But I seemed to spend the entre night tossing and turning.  In fact there will have been moments of sleep in between, but it felt like I was always wide awake, not even drowsy.

It was only in the morning that i realised the reason, one I should have thought of the night before.

My phone is a beeper.

Maybe you have never had one, but if you have you know exactly what I mean.

I have two phones, an iPhone (which I will return to later) and a Samsung ACE Android.  I usually use the alarm on the iPhone, but last night, knowing it was important I did not oversleep, I set the alarm on both.  Maybe it was just late and after a three week trip away from home, simply tired, but I forgot …

… my Android phone is a beeper.

Maybe all Androids are, or maybe all Androids with a particular version of the operating system, or maybe just the Samsung ACE, but certainly mine is.  It is why I normally have it switched off at night.

Is your phone?

At random moments, without rhyme or reason it just beeps: little chirrups, very jolly sounding, but often utterly incomprehensible.  Some I understand: a message has arrived, the power has been connected, it is fully charged and wants to be disconnected.  But other times, I hear the beep, look at the phone, and there is no apparent explanation.

Of course in the night the beeps wake you up, but as they are short, you don’t realise why yo are awoken.  I should have remembered, It is not the first time I have had a beeping phone.

My first awareness of beepers was nearly ten years ago.  For a period of nearly two years I had continuous insomnia.  I would go to sleep, but I would wake nearly (in retrospect probably exactly) every hour.  One day I was at a hotel and something else must have woken me and before I fell back to sleep I heard a beep.

I think I had a Sony-Erikson phone at the time, and when it was fully charged it beeped.  If you ignored the beep it would wait an hour and then beep again, and again, and again. In the daytime I had hardly noticed the habit, but in the night it woke me, but of course I had never realised what had woken me, until that moment. The next night I turned off the phone and used a separate alarm clock.  For the first time in two years I slept through the night.

Walk around your house at night: it is now rarely dark, every device has an LED some, continuous, some flashing; indoor light pollution.  Have you, like me, sometimes had to cover a laptop with a T-shirt to stop its flashing keeping you awake?  Less obvious are the various beeps, buzzes, and chirrups.  Some are loud, long and insistent, the ring of a phone, or loud ding of a microwave when ready.  Others are short and sharp, deliberately low-key so as to remind, but not annoy.  In our house the tumble drier gives a small periodic beep to remind you that the programme has finished.

During the day time these are just part of the backdrop of life, indeed if you live in town they may well be drowned by the background drum of distant traffic.

However, if you find yourself unaccountable waking at night, seek out the audio polluters of your home.

Because these reminder sounds are short, you never know what woke you, but like any unexpected sound in the night, they hit your deepest startle responses and leave you suddenly, unaccountably, wide awake.

Of course, the phone knows the time of day – that is why I used it as an alarm – so why not mute the less critical sounds during the night.  And yes, I have tried lots of settings to quieten it, but some, particularly power-related beeps, seem insensitive to my attempts to silence them.  And of course I do not want to silence the potential emergency phone call in the night, just the inconsequential reminders.

Of course, if the phone does insist on beeping at least it could have some sort of notice to say why!

It is not just these notification beeps that can cause problems.  IT systems, and phones in particular, seem remarkably time insensitive.

My first mobile phone was on Orange, supplied by my university when I was an Associate Dean and part of ‘management’.  Orange specially modify their phones, so that, even on early phones, you got visible indications of phone messages.  Furthermore, if someone rang you and left a message while you were on the phone or temporarily out of signal, you would get a call back from the answering service as soon as you were available.

Later, when I had a phone of my own, it was Vodafone.  Vodafone’s answering service on their mobile network appears to be completely separated from the actual phone system.  There is some sort of ‘redirect on busy’ that takes you through to the separate system, but, unlike Orange, it has no way of knowing when you are next available.

Now-a-days it seems to only text you, but, maybe because the service started before text messaging was common, the early versions worked by ringing you back.  However, being unaware of your availability, it simply rang you back at increasing intervals: first of all immediately the message had been left, then a few minutes later, then a slightly longer gap, until eventually it would give up for several hours before trying again.

You can probably already imagine the story.  It was quite common to have long phone conversations with family members late at night, maybe at 10:30 or 11pm for an hour.  During that time someone else would try to ring and leave a message.  The answering service would try to ring, but of course we would still be on the phone, then a minute later, five minutes, ten, twenty minutes, but we were still on the phone.  Eventually it would give up and wait two or three hours.  At 2am when we were fast asleep the phone would ring.  Thinking it was a dire emergency, we would leap out of bed, only to find a short message saying, “sorry to miss you, will try again tomorrow”.

How difficult would it have been to alter these timings at night?

I said I used the iPhone as my normal alarm.  It does make the occasional incomprehensible beep, but usually only just after you have been using it.  I assume these are due to some operation started by your interactions completing, maybe mail arriving, but I can never tell.  Just as on the Android, would it be too much to ask, even if only as a UI guideline, that every audible notification has  a clear visible explanation as well?

However, on the whole it is a silent sleeping partner.

Well, with an exception.

I have iCal connected between phone and laptop and also to my Google mail.  The default import seemed to set both the Google events and events received by email as ICS attachments to have a 10 minute notification.  Although I didn’t necessarily always want this, it was not a big problem.  Except for all-day events.  These are recorded specially on both platforms and iCal certainly knew they were day events.  An example might be that a conference was on.

We now come to what the telecoms industry calls a ‘feature interaction‘ problem.

Although iCal knew it was an ‘all-day’ event, for notification purposes it treated the event as if it was a timed event from midnight to midnight.  So at 11:50pm, the night before the start of an event, a notification (with associated beep!) would sound on the phone.  I rarely go to bed before midnight, so this was not usually a big problem, except when travelling abroad.  In Italy this is at 12:50am, in Greece 1:50am.

When I first noticed the problem, I was back to turning off the phone and using an alarm clock.

I tried to simply turn off the notifications, but here I hit another feature interaction problem …. except here the ‘feature’ that caused it was equally incomprehensible.

When an event comes in via email, iCal regards it as in some way ‘not your own’ and (on the laptop version) you cannot edit it, only delete it.  The event is not live linked, it is merely a copy, so I can understand in some way marking it as edited, but why prevent you from editing it?  For example, if I have had an email notification of a meeting and then a call to say the meeting has moved, I can only delete the original (with its associated notes, distribution list, etc.), and create a new one.

Some years ago a colleague sent an invite to a regular Thursday meeting.  When the meetings stopped, he sent a cancellation.  iCal associated the two, and so the meeting stayed in my diary, but ‘crossed out’.  Years later my diary still had this regular meeting, but I was worried about deleting it (the only action available), for fear of loosing the old meetings that had actually happened and might have important information attached.

Enough time has passed and I just tried.  Sure enough it did delete all copies of the meeting past and future, with no dialogue to ask or confirm.  Furthermore, (a) the action was not undoable and (b) a few moments later, I got the following error message.

Oh dear!

So far, so bad, but, on the iPhone, iCal not only does not allow you to edit these ‘foreign’ events, but you cannot even delete them.  So, even when I can see that an event will wake me in the middle of the night I cannot get rid of it except from my laptop.

While I still cannot delete these events from the phone, at some stage I have managed to find the right setting so that the notifications do not come in the early morning, so now the iPhone is usable at night.

So let’s summarise design lessons from this:

  1. do treat all notifications with care, are they necessary, when are they likely to be useful
  2. if you deliver an ephemeral sound notification, do make sure there is some visible indicator of what it was about
  3. whether and when you produce notifications, or any behaviour, they should be sensitive to time of day
  4. try to be aware of feature interactions – but I know this is hard
  5. do not create Fascist systems (Apple that includes you) – it is my device and my data.  Surely retain some marker or indication that I have edited things that originated elsewhere, but if it is on my machine I decide what can and cannot be edited or deleted.

That’s all for now; I need to catch up on some sleep …

India and APCHI

I am sitting in the Crowne Plaza hotel in Bangelore looking down over the city spreading seemingly endlessly as far as I can see.  Here, out in the suburbs and in the heart of Electronics City, the Hi-Tech enclave, the view is a mix of green trees, concrete offices and small apartment blocks in a pastel palette of lime greens, mauve tinted blues and burnt umber.  There is an absence of yellow and red apart from the girder work of a partly constructed building and airline-warning red and white mobile antennae tower; maybe these are inauspicious colours.  A major highway and the raised highway cut across the view and the airport is presumably far out of site in the afternoon heat haze, it was a near two hour ride away on Wednesday when I arrived in the midst of rush hour, but hoping it is a shorter journey tomorrow morning when I need to catch 6am flight.

I’ve had a wonderful time here seeing many old faces from previous visits to India a few years ago, and also meeting new people.  It was especially great to see Fariza as I hadn’t realised she was going to be here from Malaysia.  It was also wonderful seeing Dhaval and spending time with his family after the end of the conference yesterday, and today reading some of his recent work at ABB on bug reproduction in software maintenance.

Seeing Dhaval’s work and talking to him about it reminded me of the debugging lectures I did some years ago as part of a first year software engineering module.  For many years I have been meaning to extend these to make a small book on debugging.  It is one of those areas, like creativity, where people often feel you either have it or not, or at bets can pick up the skills one time.  However, I feel there is a lot you can explicitly teach about each.

Yesterday was my closing keynote at APCHI 2013.  I’ve put the slides and abstract online and I am working on full notes of the talk.  It felt odd at times talking about some the the issues of rural connectivity and poverty raise by my walk around Wales given the far greater extremes here in India.  However, if anything, this makes the messages for both public policy and design more important.

As I talked both in the keynote and one-to-one with people during the conference, I was constantly returning to some of the ways that in the UK we seem to be throwing away many of the positive advances of the 20th century: the resurgence of rickets and scurvy amongst poor children, the planned privatisation of the Royal Mail, one of the key enablers of the 19th century commercial revolution, and most sad of all the depraved demonisation of the poor that is rife in politics and the media.

There were many interesting papers and posters.  Two demos particularly caught my eye as they represented different aspects of the link between physical and digital worlds, issues that Steve, Devina, Jo and I have been exploring in TouchIT and the Physicality workshop series.  One was a system that augments paper textbooks with electronic resources using a combination of computer vision (to recognise pages in the book) and semantic extraction (for example getting historical timelines from Wikipedia). The other was  a physical ‘drop box’, where you put papers into a slot and then they were copied as images into your DropBox account.  It made me think of the major scan and bin exercise I did a few years ago drastically reducing my piles of old papers.

However, the high spot of the conference for me was Ravi Poovaiah‘s keynote “Designing for the next billion” on Thursday about design for the ‘middle of the pyramid’, those who are out of abject poverty and therefore have access to basic IT and so the design community can do most about.  This does not reduce the needs of those at the ‘bottom of the pyramid’, for whom basic education and healthcare are the most immediate needs.

In the UK not only are the extremes less, few except the homeless would qualify as ‘bottom of the pyramid’, but also they tend to be more segregated. Here a modern glass fronted international retail chain can sit next to a semi-derilict (to western eyes) motorbike repair shop, with used tyres piled on the pavement.  This said, to my mind, with my aesthetic of decay that is maybe the privilege of those who do not have to live it, the latter is far more engaging.  One of India’s challenges is whether it can move through its economic explosion without the attendant dissolution of local identity, culture and family that is the legacy of the industrial revolution in the UK.

 

CHI Academy … a Faustian bargain?

I am on a short excursion from walking Wales to CHI 2013 in Paris.

Last night I was inducted into the SIGCHI Academy. No great fanfares or anything, just a select dinner and a short ceremony. I thought Gerrit, who is current SIGCHI chair would look good with a sword dubbing each person, but instead just a plaque, a handshake and a photo or two by Ben Shniederman, amanuensis of CHI.

I feel in two minds. On the one hand there are many lovely people in CHI community, and I spent a great afternoon and evening chatting to folk including Phillipe Palanque, Mary Czerwinsky and Hiroshi Ishii over dinner. However, ACM and to some extent SIGCHI often appear like the Star Wars imperial forces, intent on global domination.

The CEO of ACM did little to dispel this at the opening ceremony this morning.  He spoke of ACM’s international aspirations and praised CHI for regularly having its conferences outside of the US.

Now ACM is the de facto international computing organisation and CHI is the de facto international conference in human–computer interaction, but by virtue of the fact that they are the US ones.  In principle, IFIP and Interact are the international computing organisation and HCI conference respectively, as IFIP is the UNESCO founded body of which ACM and other national computing bodies, such as the BCS in the UK, are members.  Interact, the HCI conference sponsored by IFIP is truly international being held in numerous countries over the years (but I think never yet the US!); in contrast having approximately two out of three conferences in the US is laudable, but hardly the sign of a truly international organisation.

So, is the ACM an originally US organisation that is in the process of slowly becoming truly international, or is it part of more general US cultural domination?  Although probably neither are completely accurate, at present there seems to be significant aspects of the latter under the guise of the former.  In a way this is, in microcosm, an image of the same difficult relationship between USA and UN in other areas of international affairs.

And by joining the SIGCI Academy am I increasing the European presence in CHI and thus part of the process to make it truly international, or selling my academic soul in a Faustian bargain?

more on disappearing scrollbars

I recently wrote about problems with a slightly too smart scroll bar, and Google periodically change something in Gmail which means you have to horizontally scroll the page to get hook of the vertical scroll bar.

I just came across another beautiful (read terrible) example today.

I was looking at the “Learning Curve“, a bogspot blog, so presumably using a blogspot theme option.  On the right hand side was funky pull-out navigation (below left), but unfortunately, look what it does to the scroll bar (below right)!

   

This is an example of the ‘inaccessible scrollbar’ that I mention in “CSS considered harmful“, and I explain there the reason it arises.

The amazing thing is that this fails equally across all (MacOS) browsers: Safari, Firefox, Chrome, yet must be a standard blogspot feature.

One last vignette: as I looked at the above screen shots I realised that in fact there is a 1 pixel part of the scroll handle still visible to the left of the pull-out navigation.  I went back to the web page and tried to select it … unfortunately, I guess to make a larger and easier to select the ‘hot area’, as you move your mouse towards the scroll bar, the pull-out pops out … so that the one pixel of scrollbar tantalises, but is unselectable 🙁

Action Research in HCI

Recently Daniel Tetteroo asked if I knew about publications in HCI, prompted partly by the fact that I have described my Wales walk next year as a form of action research.

I realised that all my associations with the term were in information science rather than HCI, and other non-computer disciplines such as education and medicine. I also realised that the “don’t design for yourself” guidance, which was originally about taking a user-centred rather than technologist-centred approach, makes action research ideologically inimical to many.

I posted a question to Twitter, Facebook and the exec mailing list of Interaction yesterday and got a wonderful set of responses.

Here are some of the pointers in the replies (and no, I have not read them all overnight!):

Many thanks to the following for responses, suggestions and comments: Michael Massimi, Nathan Matias, Charlie DeTar, Gilbert Cockton, Russell Beale, David England, Dianne Murray, Jon Rogers, Ramesh Ramloll, Maria Wolters, Alan Chamberlain, Beki Grinter, Susan Dray, Daniel Cunliffe, and any others if I have missed you!

details matter: infinite scrolling and feature interaction

Many sites now dynamically add content to a page as you scroll down; this includes both Facebook and Twitter feeds, which add content as you get near the bottom.  In many ways this is a good thing, if users have to click to get to another page, they often never bother1.  However there can be unfortunate side effects … sometimes making sites un-navigable on certain devices.  There are particular problems on MacOS, due to the removal of scrollbar arrows, a usability disaster anyway, but confounded by feature interactions with other effects.

A recent example was when I visited the SimoleonSense blog in order to find an article corresponding to an image about human sensory illusions.  The image had been shared in Facebook, and I found, when I tried to search for it, also widely pinned in Pinterst, but the Facebook shares only linked back to the image url and Pinterst to the overall site (why some artists hate Pintrest).  However, I wanted to find the actual post on the site that mentioned the image.

Happily, the image url, http://www.simoleonsense.com/wp-content/uploads/2009/02/hacking-your-brain1.jpg, made it clear that it was a WordPress blog and the image had been uploaded in February 2009, so I edited the url to http://www.simoleonsense.com/2009/02/ and started to browse.  The site is a basically a weekly digest and so the page returned was already long.  I must have missed it on my first scan down, so I hit the bottom of the page, it dynamically added more content, and I continued to scroll.  Before long the scrollbar handle looked very small, and the page very big and every time I tried to scroll up and down the page appeared to go crazy, randomly scrolling anywhere, but not where I wanted.

It took me a while to realise that the problem was that the scrollbar had been ‘enhanced’ by the website (using the WordPress infinite scroll plugin), which not only added infinite scrolling, but also ‘smart scrolling’, where a click on the scrollbar makes an animated jump to that location on the scrollbar.  Now many early scrollbars worked in this way, and the ‘smart scroll’ options is inspired by the fact that Apple rediscovered this in iOS for touch screen interaction.  The method gives rapid interaction, especially if the scrollbar is augmented by ‘tips’ on the scrollbar (see the jQuery smartscroll demo page).

Unfortunately, this is different from the Mac normal behaviour when you click above or below the handle on a scrollbar, which effectively does screen up/down.  So, I was trying to navigate up/down the web page a screen at a time to find the relevant post, and not caring where I clicked above the scroll handle, hence the apparently random movements.

This was compounded by two things.  The first is a slight bug in the scrolling extension which means that sometimes it doesn’t notice your mouse release and starts scrolling the page as you move your mouse around.  This is a bug I’ve seen in scrolling systems for many years, not taking into account all the combinations of mouse down/up, enter/leave region etc., and is present even in Google maps.

The second compounding factor is that since MacOS got rid of the scrollbar arrows (why? Why? WHY?!!), this is now the only way to reliably do small up/down movements if you don’t have a scroll wheel mouse or similar.

Now, in fact, my Air has a trackpad and I think Apple assumes you will use this for scrolling, but I have single-finger ‘Tap to click’ turned off to prevent accidental selections, and (I assume due to a persistent bug) this turns off the two finger scrolling gesture as well (even though it is shown as on in the preferences), so no scrolling from the touchpad.

Since near the beginning of my career I have been fascinated by these fine design decisions and have written previously about scrollbars, buttons, etc.  They are often overlooked as they form part of the backdrop to more significant applications and information.  However, the very fact that they are the persistent backdrop of interaction makes their fluid usability crucial, like the many mundane services, buses, rubbish collection, etc., that make cities work, but are often unseen and unnoticed until they fail.

Also note that this failure was not due to any single feature or bug, but the way these work together what the telephony industry originally named ‘feature interaction‘, but common across all technological systems  There is no easy fix, apart from (i) thinking of all possible scenarios (reach for your formal methods in HCI!) and (ii) testing across different devices.  And certainly (Apple please listen!) if it ain’t broke, don’t fix it.

Happily, I did manage to find the post in the end (I forget how, maybe random clicking) and it is “5 Ways To Hack Your Brain“.  The individual post page has no dynamic additions, so is only two screens big on my display (phew), but still scrolled all over the place as I tried to select the page title to paste above!

  1. To my mind, early web guidance, was always wrong about this as it usually suggested making pages fit a screen to improve download speed, whereas my feeling, when using a slow connection, was it was usually better to wait a little longer for one big screen (you were going to have to wait anyway!) and then be able to scroll up and down quickly.[back]

First version of Tiree Mobile Archive app goes live at Wave Classic

The first release version of the Tiree Mobile Archive app (see “Tiree Going Mobile“) is seeing real use this coming week at the Tiree Wave Classic. As well as historical information, and parts customised for the wind-surfers, it already embodies some interesting design features including the use of a local map  There’s a lot of work to do before the full launch next March, but it is an important step.

The mini-site for this Wave Classic version has a simulator, so you can see what it is like online, or download to your mobile … although GPS tracking only works when you are on Tiree 😉

Currently it still has only a small proportion of the archive material from An Iodhlann so still to come are some of the issues of volume that will surely emerge as more of the data comes into the app.

Of course those coming for the Wave Classic will be more interested in the sea than local history, so we have deliberately included features relevant to them, Twitter and news feeds from the Wave Classic site and also pertinent tourist info (beaches, campsites and places to eat … and drink!).  This will still be true for the final version of the app when it is released in the sprint — visitors come for a variety of reasons, so we need to offer a broad experience, without overlapping too much with a more tourism focused app that is due to be created for the island in another project.

One crucial feature of the app is the use of local maps.  The booklet for the wave classic (below left) uses the Discover Tiree tourist map, designed by Colin Woodcock and used on the island community website and various island information leaflets.  The online map (below right) uses the same base layer.  The map deliberately uses this rather than the OS or Google maps (although final version will swop to OS for most detailed views) as this wll be familiar as they move between paper leaflets and the interactive map.

   

In “from place to PLACE“, a collection developed as part of Common Ground‘s ‘Parish Maps‘ project in the 1990s, Barbara Bender writes about the way:

“Post-Renaissance maps cover the surface of the world with an homogeneous Cartesian grip”

Local maps have their own logic not driven by satellite imagery, or military cartography1; they emphasise certain features, de-emphasise others, and are driven spatially less by the compass and ruler and more by the way things feel ‘on the ground’.  These issues of space and mapping have been an interest for many years2, so both here and in my walk around Wales next year I will be aiming to ‘reclaim the local map within technological space’.

In fact, the Discover Tiree map, while stylised and deliberately not including roads that are not suitable for tourists, is very close to a ‘standard map’ in shape, albeit at a slightly different angle to OS maps as it is oriented3 to true North whereas OS maps are oriented to ‘Grid North’ (the problems of representing a round earth on flat sheets!).  In the future I’d like us to be able to deal with more interpretative maps, such as the mural map found on the outside of MacLeod’s shop. Or even the map of Cardigan knitted onto a Cardigan knitted as part of the 900 year anniversary of the town.

     

Technically this is put together as an HTML5 site to be cross-platform,, but … well let’s say some tweaks needed4.  Later on we’ll look to wrapping this in PhoneGap or one of the other HTML5-to-native frameworks, but for the time being once you have bookmarked to the home page on iOS looks pretty much like an app – on Android a little less so, but still easy access … and crucially works off-line — Tiree not known for high availability of mobile signal!

  1. The ‘ordnance‘ in ‘Ordnance Survey‘ was originally about things that go bang![back]
  2. For example, see “Welsh Mathematician walks in Cyberspace” and  “Paths and Patches – patterns of geognosy and gnosis”.[back]
  3. A lovely word, originally means to face East as early Mappa Mundi were all arranged with the East at the top.[back]
  4. There’s a story, going cross browser on mobile platform reminds me so much of desktop web design 10 years ago, on the whole iOS Safari behave pretty much like desktop ones, but Android is a law unto itself!.[back]

Death by design

Wonderful image and set of slides describing some of the reasons multitasking is a myth and how the interfaces we design may be literally killing people (during a mobile outage in Dubai cat accidents dropped by 20%).

Thanks to Ian Sommervile for sharing this on twitter.