|
|
 |
Developing a Windows® Sidebar Gadget in Windows XP
In theory, developing software on one platform for a completely different (and new) target platform is something developers should be able to handle without difficulty. In practice however, there are many pitfalls that can await even the smartest developers. Justin Whitney discusses the challenges he faced (and overcame) in developing the Destination.NET Windows® Sidebar Gadget on Windows XP.
|
|
|
Many developers, particularly contractors or those who support multiple operating systems, run into the same problem anytime a new OS comes out: developing for the new OS while still supporting the older one. Usually it's not so much of an issue. But Windows Vista differs dramatically from Windows XP in many ways. For example, Window Vista Sidebar Gadgets will only run in the Windows Vista Sidebar. The developer has no way of emulating the Sidebar environment in another OS, so development must be done in Vista. But if you're primary development environment is Windows XP, what should you do?
Here are the options I tried when developing this Gadget:
- Install Windows Vista on another machine.
I happen to have another computer available for experimenting. Unfortunately, it didn't meet the hardware demands of Windows Vista, so I wasn't able to use it for this project.
- Install Windows Vista on a Virtual Machine.
In a word, No. In several words, No, No, No, No, No! Having used VMs successfully for experimental development in the past, I naively tried installing Windows Vista on one. First, I made the mistake of using an external hard drive. But performance issues immediately revealed the folly of such an attempt, so I copied the VM to my internal hard drive. That was faster, but still excruciatingly slow. Miss the days when dragging a file onto your desktop took 15 seconds or more? Install Windows Vista on a VM and relive the glory.
- Ajax development on Windows XP.
Since I could watch an episode of Heroes in the time it took to open an HTML file in Notepad on this Windows Vista/VM mess, and presently stuck for other options, I decided to move as much development as I could off of Windows Vista and back to my Windows XP environment. A Gadget of this type is essentially an Ajax-driven Web app. So I treated it as such. Rather than separate files for the flyout and settings pages, I put everything onto one page and used <div> tags to organize sections of code. Meanwhile, I wrote Gadget-specific code but commented it out and used regular JavaScript to duplicate functionality until I moved the app to Windows Vista. This gave me the chance to use several tricks right off:
- I employed time-tested "alert()" statements to debug JavaScript.
- I added several feedback divs throughout the page to keep track of what my code was doing.
- Since I was new to Gadget development, I could polish the more familiar JavaScript and fine-tune persnickety CSS code (still a weakness of mine), eliminating functional bugs before I ever got to the all-new Gadget bugs.
- Dual-boot Windows XP and Windows Vista.
XP-side development worked well up to a point. But eventually I had to move it back to Windows Vista where it belonged, and using a VM just dragged out the process to an unacceptable degree. So I found myself returning to an earlier option. I play with so much volatile software that I prefer installing VMs so I can just blow them away when they misbehave. I avoid using partitions since I never know what's going to crawl over the wall and wreak havoc on my primary system. But since Windows Vista is on the shelves, I decided it was worth the risk. Unfortunately, a first glance reveals that most partitioning software, such as Norton PartitionMagic 8.0 doesn't support it as of this writing. But after exacting a promise from Acronis that their Disk Director did indeed support Windows Vista, I decided to risk it.
The result? Acronis gave me major problems. First I couldn't load it. Then I couldn't use it. Then it told me I was using demo software and had to buy the full version (which I was using). Customer service chat, while prompt at answering sales calls, referred me to an e-mail for tech support, which took three days to respond with the wrong solution. In the meantime, I somehow dug up a fresh build that was buried on their site. Thankfully, it fixed the problems I was having. After that, my new dual-boot Windows Vista worked fine. I was able to tweak the Gadget code, which had significant architectural and syntactical differences from my Windows XP version. I even made the demo video you see on this site. But literally minutes after finishing the video, Windows Vista force-fed fourteen critical updates to my system, crashing on the thirteenth. It crashed big. It crashed hard. And it corrupted the OS beyond repair, to the point that, as of press time, I've yet to load it again successfully.
In summary, if you find yourself having to run both Windows Vista and Windows XP, I would suggest getting a second spec-ready dev station, if at all possible. If not, go with the partition option, but backup early, backup often, and keep your install DVD handy. And avoid updates until the project is done.
* This article was commissioned by and prepared for Microsoft Corporation. This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.
|
|
|
|