February 19, 2005

DependencyObject

The DependencyObject is at the heart of Avalon. I've heard that the concept has been done before in older languages, but I can't remember the reference (no pun intended). I've collected some links to articles that would have helped me a lot if they had been available when I started at MS.

Avalon: Understanding DependencyObject and DependencyProperty

Avalon Dissected Part 1: Core Technologies

Joe Beda's elaboration on Part 1

Avalon Dissected Part 2: UIElement <- FrameworkElement <- Control

DependencyObject Class (MSDN)

DependencyProperty Class (MSDN)

Avalon Property Invalidation

I wonder what it'd be like to attempt something similar in the Flash component framework instead of the Flash MX 2004 V2 architecture's mix-ins. Can't think of any reason why not. It wouldn't be as good as what you could do with the CLR, but it'd be better than mixins. I think it's totally doable... the terrible beauty of a functional and prototype-based language like Actionscript 2.0/Javascript is that everything feels like a hashtable anyways... even the AS2 implementation of namespaces is just a hash of the Object prototype.

Posted by samuel at February 19, 2005 11:35 AM
Comments

Hey Sam,

We actually are moving that to swf at the moment (with Xamlon for Flash) - well sort of... The Xaml markup we use has dependancy properties of course, but because swf is more of a binary target for us we can take a lot of liberties with the action tags we generate. I'm not sure if we will use dependancy properties in the C# code we are using to build the swf components though (that targets the swf api directly, so it doesn't map one to one with the xaml backend code, just the markup). The whole dependancy object thing does work pretty well though, and I would prefer it to mixins any day. You so are right about the 'terrible beauty' of things feeling like one big hashtable in as/js, that is for sure, exactly the right words : ).

That being said, I'm still not sure of how I feel about dependancy properties. Sometimes I think they are just something tacked on that lets you sort of circumvent static typing, not sure how much of a plus that is --it seems what they really want is multiple inheritance. Not that I ever use eifflel, but with the backflips we all do to get things like this to work (and with the reams of unit tests we all write), maybe its time admit they were right and move these types things down to the language level : ).

Thanks for the post- I wish I had both the articles and your handy set of links when I started out with xaml : ).

Posted by: Robin Debreuil at February 19, 2005 02:21 PM
Post a comment









Enter the letters as shown in the box below:



Remember personal info?