Title Image

Don Xml's Grok This

The home of Don Demsak
Welcome to Don Xml's Grok This Sign in | Help
in Search

This Blog

Syndication

Site Sponsors

DonXml's All Things Techie

Fumiaki Yoshimatsu’s Refactoring the XAML Analog Clock

Fumiaki had a go at refactoring the XAML analog clock and tried to use a MVC design approach.  He didn’t like that I was using 3 timelines, and came up with a pretty ingenious solution, something I didn’t think of.  He switched the hands of the clock from paths to a line, and then binds them to a clock class (the Model) that he created.  Pretty nifty solution, but it totally removes the benefits of using declarative animation.  It is a very hard concept to get your head around, so if you haven’t fully grokked it yet, you may want to check out Fumiaki’s solution, and compare the 2.  It would be a great way to learn about both styles.  The other problem is that because he couldn’t bind to the transformation elements, he had to switch from a path to a line (see my article on why I used a path), and redraw the line every time there is an update.

Overall, I wouldn’t suggest using this approach in this situation, and I think the MVC mentality is the problem here since it collides with the declarative model.  I agree that the 3 timelines running in parallel is not the most technically correct, and could be done using 3 nested timelines, which is a bit more correct.  The one thing that I would like to do to upgrade the clock is have the second hand move every second, instead of a continuous sweeping motion, and add the sound of a tick (to make it even more like a pendulum clock).

DonXML Demsak

Published Tuesday, January 13, 2004 8:54 AM by donxml

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Fumiaki Yoshimatsu said:

Wow! I would like to thank you for having a look at mine!
For the declarative animation, I agree completely that it will be great to have it. It will be great to have some kind of reference to a timeline in XAML, don't you think? I am not a big fan of MVC pattern either, but in this case, I felt so weird to have three 'stop watches' to be a clock, and so thirsty to write some XAML app (my LH machine haven't even been powered these days), that it was a great experiment to write it.
January 13, 2004 5:22 PM

Steve Hiner said:

I assume getting rid of the extra timelines would reduce the CPU usage right?

I was playing with the SVG analog clock the other week. I wanted to use it as an ActiveDesktop item but I found that it sucked up about 80% of my processor so I dropped the idea.
January 14, 2004 5:59 PM

Leave a Comment

(required) 
(optional)
(required) 
Submit

About donxml

I’m an independent consultant, specializing in .Net solutions architecture, based out of New Jersey who also doubles as an evangelist for XML, Domain Driven Design, enterprise architecture and .Net. I do not work for Microsoft, the W3C or any other big company that you may know of (at least not yet). I’ve been an indie for over ten years, and although I’ve been tempted a couple times to take a job with companies like Microsoft, I’ve haven’t found something better than my current situation. I work mostly with the large pharmaceuticals that are based here in New Jersey, and usually find myself on long term contracts. Definitely not the prototypical indie consultant, but it lets me dedicate time to my non-income generating activities like the developer community stuff, plus financing open source projects like XPathmania and MVP-XML. If you would like to talk to me about doing some contract work, just contact me via the contact page. My rates vary widely, depending on lots of different variables, but mostly distance from Jersey, and type of work. Plus, I’ve been known to donate some of my code for various projects.
Powered by Community Server, by Telligent Systems