Being One with the DOM

by Ed on May 14, 2007

Over the past couple of weeks, I’ve been doing a lot of work with our Konfabulator DOM. In some ways, we are completely redoing it so we can use it as the basis for everything (finally). I have also been looking at better ways to expose it via JavaScript.

What I continuously learn is that I really didn’t know the DOM spec like I thought I did. There is a lot of subtlety in the language that isn’t quite clear until you finally live the life for yourself. Over the weekend I was trying to get some stuff straight in my head. After working through it and getting my head around how to organize things, I was reading the W3C spec and noticed that it had basically said what I had just realized all along. It’s not super-obvious unless you really know a DOM implementation inside and out and have had to understand the design out of necessity. It’s a bit akin to my experience in karate where you’ll have someone tell you things a million times and then once you do it a zillion times you finally get it and say “my god, they’ve been telling me this all along”. There’s so much about learning that’s about experience and not words.

But of course the good news is that our DOM is much cleaner now and can be used for more things. I still need to figure out if I want to switch to use an Interface idiom ala Mozilla. It would simplify some things, but complicate others. More to think about. If I do go with Interfaces, I’ll probably just rely on C++ and not go so far as to use something like xpcom internally. That seems a bit much. But if I do C++ for now, it should be relatively straightforward to switch later if for some reason a COM-like solution was needed.

By far the trickest part is going to end up being how we expose things via Javascript. I’m not happy with the amount of work we have to do to expose a class. Too much repetitive work. I guess if we did use xpcom it would be a lot simpler since xpconnect does all these things for you. But that is biting off way more than we can afford to chew right now. Phasing is critical to success long term. I do have a decent hybrid solution in mind that can bridge the gap from where we were and a completely generic solution such as xpconnect.

Once our new foundation is in place it’s going to make a huge difference in what we’re able to do and how quickly we can do it. A lot of doors are going to open up when I’m done. It’s going to be pretty cool. If only I could finish!

{ 0 comments… add one now }

Leave a Comment

Previous post:

Next post: