AB's Blog: March 2010

Monday, March 15, 2010

Using Microsoft's Natal as a tool for children with Autistic Spectrum Disorder.

3 comments
Last week I stumbled across an article about Microsoft's Project Natal for the Xbox. I had seen something about Natal a while back, but until last week, had totally forgotten about it, which got me thinking again. For quite some time now I have had a real interest in NUI design, both as a personal interest and also something I have repeatedly tried to raise as a genuinely interesting possibility for various multi-touch client applications for the company I develop software for. But so far this hasn't been embraced with much enthusiasm. However Natal takes things one step further, and I quipped in a comment on Richard Banks blog on Rethinking the IDE, that perhaps Natal could be used as part of a coding IDE in response to his question at the end. So after spending a little time looking at the videos from the Project Natal site, I came across the Project Natal: Meet Milo video, from Lionhead Studios.





Now it's a little bit hard to tell exactly how much of what's going on in that video is smoke and mirrors and how much is real AI and "non-scripted", I'm guessing there is a reasonable amount of smoke and mirrors, but I don't think this takes away from the concept, at least in terms of what I was thinking. My initial reaction to this was not that this takes interactive gaming to a whole new level, which it certainly has the potential to, rather, a variation of this could possibly be an amazingly useful tool for kids with autism and in particular Asperger's Syndrome.


Firstly a little background. I assume most people have at least heard of autism, and being in the software/engineering/science field, we seem to be over represented in the statistics for autism, especially Asperger's Syndrome (which is just part of autism), and many of us certainly have a tendency towards that end of the spectrum or certain aspects of that personality type (see the now famous, although unscientific article from Wired titled "The Geek Syndrome"). But for anyone not entirely familiar, autism is a classified as a developmental spectrum disorder primarily affecting social interaction and communication (far more profoundly than "just shy") as well as a range of other behavioural and cognitive differences. That's the one simple liner. For a better, but by no means definitive, overview I'd recommend wikipedia's entries on Autism Spectrum and Asperger's Syndrome. But just to be clear though Geekiness != Asperger's, although we know that Asperger's Syndrome is often associated with Geekiness.

The reality for people with ASD , however, is they are required to live mostly in a world dominated by complex social interactions which can confuse, frustrate and even baffle them at times. Equally, "normal people", or as the autistic community likes to call them, "neurotypicals" (NT's), have a difficult time understanding the differences of people with autism with respect to their own "normal" behaviour. Fortunately there are a number of interesting as well as possibly clinically valid therapies and approaches to assisting people with ASD cope and understand the social world. And there are some pretty dedicated psychologists, researchers and therapist as well. But there are no magic bullets and no "cures". (I use the word cure very loosely here as some would argue; "what is there to be cured of?").

So how does this all fit with Natal? For those who have not really had anything to do with ASD before it might not be immediately obvious, but as I outline above, one of the core characteristics of ASD is a different/impaired (in a relative sense) understanding of social interaction and communication. Current mainstream therapies revolve around teaching social interactions and conventions using role play and story cards known as Social Stories(tm). And this is where the "Meet Milo" concept created by Lionhead Studios triggered off one of those idea connection moments. Perhaps it could be adapted to be something like a very fluent and natural personal trainer for people with ASD to assist with teaching social interaction and communication, especially children. I think anyone who has had any close experience with ASD and who has watched the Meet Milo video would immediately see the possibilities for a tool along the lines of a social personal training application. Many of these kids have a keen interest and attraction for computers, especially computer games, as it's all about predictability. A computer isn't vague and nuanced, and doesn't suddenly change mood for no apparent reason. But software might just be able to simulate aspects of that.

During the video it is mentioned that Milo exhibits body language and facial expression, which are usually very difficult aspects of human behaviour for people with ASD to pick up on. So it probably wouldn't be too difficult to create some kind of interactivity where a character behaves in a particular way, similar say to how Milo behaved, and where the person interacting is required to respond in the appropriate way. I don't think there would really be a requirement for the software to try and read or gauge the users body language or emotion (like supposedly shown in the video - not convinced about that by the way). But the main thing would be to have the user pick up on the appropriate social communication being displayed by the character and to choose or perform an appropriate response. The idea would be for the user to learn and practice particular social scenarios which in theory can be applied to real life when needed.

I could also envisage a scenario whereby the characters might start out being quite abstract and not very human like and gradually become more realistic as the user become more comfortable and progressed. Or it could even be presented somewhat like an adventure where there are challenges to complete interwoven making the learning experience both more fun as well as subtle.
And just to add my two cents worth...

With the prevalence of ASD now looking to be about 1% and consistent across all age groups and possibly cultures (see CDC Survey and NHS Study), it seems the evidence is currently leaning towards the disorder being an underlying state of the general population. Although a real rise in numbers can't be completely ruled out it is looking increasingly unlikely a real rise is the case, but rather an artefact in better and broader diagnosis .

OK. I've already made a slight detour from my intended aim of this blog, but this idea and topic just seemed too interesting and compelling to not blog about.

Normal transmission shall now resume..

Thursday, March 11, 2010

Setup Moq to return different values on multiple calls

1 comments
I recently came across a problem, using the Moq mocking framework, in which a few tests, required a method on one of my mocked objects to be called multiple times but return a different value depending on when the call was made. Something you can do with Rhino Mocks. But nevertheless.

The sequence may have looked something like:
Call 1: mockedObject.IsValid() returns true
Call 2: mockedObject.IsValid() returns false

My solution to the problem, which is sort of outlined in the Moq Quick Start was:

[TestMethod]
public void MultipleReturnValue_Test()
{
   bool firstCall = true;
   var mockedObject = new Mock<ISomeInterface>();

   mockedObject.Setup(o => o.IsValid()).Returns(() =>
      {
         if (firstCall == true)
         {
            firstCall = false;
            return true;
         }
         return false;
      });

   var sut = new MySystemUnderTest(mockedObject.Object);
   sut.DoSomething();

   Assert.IsTrue(sut.ExpectedCondition());
}

Not beautiful, but It works fine. The first call to IsValid() returns true, while any subsequent calls return false.

This raises the question, how much logic in a test is too much?

Blogger/Google Reader irritation

0 comments
Ok, first gripe. I've just added blogs I follow, and used the "add from Google Reader" feature and checked the boxes. Great, it automatically added those blogs into the "Blog's I'm following" section of my dashboard. Unfortunately, it's also added them AGAIN to my Google Reader list! Why?

First Post

0 comments
I guess I have to start somehwere. I have ideas that I'd like to spew out into the blogosphere, just to add to the noise. Like we need it. :)


Who am I?
I've been a software developer and consultant for 16 years.


So what ideas?
For now I plan to blog about WPF, Silverlight, MVVM, TDD and generally .Net and C#.


At this stage I'd like to keep this going and hopefuly people will be interested in reading my stuff. But who knows how it will all pan out. Right now, I'm just talking to myself really.