Archive for March, 2009

h1

Thread Safety in a (Property)Changing World

March 8, 2009

 

I’m really loving the power and simplicity of MVVM (Model View View-Model).  The View-Model communicates changes to the binding system via the ‘PropertyChanged‘ event of INotifyPropertyChanged.  I also like to communicate changes from the Model to the View-Model via this event.

But there is a potential rub here.  Whenever you do some work on a background thread, you need to make sure you pass execution back to the UI thread if the resulting activity ends up changing the UI (a foregone conclusion really when firing PropertyChanged).  It’s a real drag having to invoke the Dispather whereever you know (or suspect) firing the event will cause a threading exception because an attempt is made to update the UI on a background thread.

Well, after poking through Nikhil’s excellent framework/sample – I found a great way to remove this drag from my life (and your life) forever!  Below is a base class you can use to derive model’s and view-models on that will always fire the PropertyChanged event over on the UI thread.  Dispatcher arbitrage is now a gone-burger.

 

NotifyPropertyChangedBase

 

And for good measure, here’s an asynchronous unit test that verifies this behavior:

 

Thread Safe NotifyPropertyChanged - UnitTest

h1

Office in Silverlight…I thought so!

March 7, 2009

Well, it’s been so shockingly long since I’ve been posting that I only have to go back four entries to point out a prediction I made ways-a-way back in Oct 2007:  Office will port to Silverlight (or words to that effect).

I know, scrolling 4 posts down is going to be cumbersome, so here’s a link too.

Well, it seemed obvious back then to me, and now it turns out it’s well on it’s way.  Here‘s a somewhat limited video on Channel 9, but there’s enough in there to see what’s a cookin.

Excel in Silverlight

http://channel9.msdn.com/posts/PDCNews/First-Look-Office-14-for-Web/

Big emphasis on the real-time collaboration aspects, which is the right thing to do of course.  But what’s interesting to me is in the demo they only showed editing in Excel and OneOne, not in Word.

Why?  Is this too hard to do?  The RichTextBox has not been developed for Silverlight yet (although some 3rd party ones have sprung up recently).  I assumed MS was staying clear of RichText for the same reason the browser editing control (IMO) got stunted in it’s development ascent….so that it wouldn’t compete with Word.  So, what’s going on?  Is it just that it was an early demo and they hadn’t done it yet, OR is the editing surface fundamentally too hard to replicate in Silverlight, OR are they making it a read only experience to avoid other nasty competitive issues by having that technology developed and floating around in Silverlight land?

Most important to me is that this shows large commitment my MS to Silverlight, and that it will become a dominant platform in line-of-business, enterprise app space. And, of course, that the platform is grunty enough to support some serious interaction developments.

h1

History of the Internet

March 7, 2009

Here’s a wonderful history of the Internet in a visually light and delightful form.

History of the Internet (Video)

http://vimeo.com/2696386

I’m not sure about the initial impression given of mainframes just before time-sharing kicked in.  It wasn’t a step back to go to mainframes, because there wasn’t any kind of accessable ‘interactive’ computer prior to that…it was all punch cards, which was shockingly hard to develop in from all accounts (and no Google…how did they do it?).

On this general theme of computer history, one of my favorite reads of late was:

What the Dormouse Said: How the 60s Counterculture Shaped the Personal Computer

Typically accounts of modern computer history (the PC) start at around 1970 with Apple and the usual suspects. What is interesting about this book is that it concentrates on the 2 decades prior to this, and details the pioneering work of Englebart (Human Augmentation Lab), McCarthy (SAIL, Stanfard Artificial Intelligence Laboratory) and a slew of other characters that emerged from the 60′s counter culture and shaped what became one of the most significant developments in modern history…the “personal” computer.  What’s exciting about this read, for me, was that by all account many of the pioneering ideas have yet to be implemented.  Certainly Alan Kay said the same thing to Doug, Scott and I as we drove him up to LAX last year, “go back and read Englebart!  It’s all there.”

Follow

Get every new post delivered to your Inbox.