Print

Windows & .NET Watch: Fun with WPF applications



Larry O'Brien
Email
January 1, 2010 —  (Page 1 of 2)
Silverlight 4 is now available in beta form. I decided to take it for a test drive by implementing some calendars for amateur astronomy. Specifically, I wanted to use Silverlight to calculate and graph the positions of the four Galilean moons of Jupiter, including interesting events like occultations, shadow transits and the position of the Great Red Spot.

The task highlights the advanced display model of WPF/XAML, with a combination of standard controls for setting the date and time parameters, dynamically repositioned and scaled lines for scaling the calendar, and totally dynamic paths for the satellite’s positions. Visual Studio 2010 (now in Beta 2) includes a complete visual design surface for Silverlight, allowing me to rough out a design declaratively (including visual prototypes for the curves I wanted to draw).

The Model-View-ViewModel pattern has come to be the de facto standard design for WPF applications. In this pattern, the “Model” retains its standard meaning as those elements relating to the domain. The “View” is also quite familiar as the user interface, but is more passive than the view in the traditional “Model-View-Controller” triad; in MVVM, the View typically relies heavily on the data-binding facilities of the .NET Framework to attach to the “ViewModel,” which houses the UI’s interaction logic. In this way, the View is almost like a concrete implementation of the ViewModel’s abstraction (“almost” because the ViewModel is not a pure abstraction, and the two are not related by class inheritance but by data-binding).

Because the View is so loosely coupled to the ViewModel (at least visibly; the infrastructure for data-binding is complex but hardly ever requires attention), view “stuff” is easy to test. This was especially useful in my application, where one view is animated, and another boils down to a bunch of sine waves superimposed on a ruler-like calendar that needs to be accurate when fully zoomed in.

Just to make things interesting, my Model initially disagreed with other calculators. I cannot deny jumping to the conclusion that I had a time zone problem (in any application that references time in any way, there will at some point be bugs relating to time zones), but tests saved me from countless hours trying to find the problem by judging, “OK, it looks like Io and Ganymede cross on the 17th around 10 UTC. Is that right?” (It turned out that the orbital constants I used were based upon a non-standard epoch. Live by the easy Internet search, die by the easy Internet search.)



Related Search Term(s): Silverlight, Visual Studio

Pages 1 2 


Share this link: http://sdt.bz/34031
 
Most Read Latest News Blog Resources

Add comment


Name*
Email*  
Country     


  • Comment
Loading




close
NEXT ARTICLE
News Briefs: December 15, 2008
AccuSoft creates an SDK for Web imaging software, while Artisan releases a free version of Artisan Studio. Also, Bredex, Embarcadero, Ilog and others provide updates for some of their products Read More...
 
 
 
 
News on Monday
more>>
SharePoint Tech Report
more>>


   

 
 

Download Current Issue
MAY 2012 PDF ISSUE

Need Back Issues?
DOWNLOAD HERE

Want to subscribe?


 
blogs tab
Creation
To write better software, cultivate your ability to be creative.
05/19/2012 07:40 PM EST

Slick...but who needs it?
compilr.com is a well-designed site and the folks behind it seem to have their heart in the right place. But...who needs it?
05/16/2012 12:45 PM EST

How to be a better software developer
Want to be a better developer? You won't get there by mastering an interesting language or learning a new set of APIs.
05/14/2012 12:18 PM EST

Wooing Galatea
Do yourself a favor and check out Galatea 2.2, a wonderful book by novelist Richard Powers.
05/12/2012 07:05 PM EST

The world as story
An artificial-intelligence system at Carnegie Mellon seeks to understand the world by making statements about it.
05/10/2012 06:39 AM EST

The Rise of the Brogrammer, or the Rise of the Sexist Programmer?
Women in Silicon Valley get vocal about sexist ads and campaigns that contribute to a tense work environment.
05/09/2012 03:14 PM EST

 

Events calendar tab
5/23/2012 to 5/24/2012
Chicago
IEG

6/3/2012 to 6/7/2012
Orlando
IBM Rational

6/10/2012 to 6/15/2012
Las Vegas
SQE

6/10/2012 to 6/15/2012
Las Vegas
SQE

6/11/2012 to 6/14/2012
Bellevue, Wash.
AMD