Writing a gadget was an ….interesting experience for me. And though I have legions of people to thank for helping when I got stuck, I did indeed write it myself….
It all began months ago, in May, when I was alone in a stark and industrial room with two shady characters….I mean coworkers….and the blinds were drawn. Or else it was windowless. Same thing.
Ed Harris, dev lead, said: (in a kindly tone) You crazy pm, we don’t have developers available for doing gadgets right now, we have to ship our product!
…But I don’t have time. I have to code the entire front end of QnA. Gotta go.
Ed turned to Betsy after Patrick leaves: Why don’t you dev it yourself? (in his famous “ double dog dare you” voice). It shouldn’t that hard.
Segue to a white tile kitchen table. (Betsynote: I don’t know what it is this time, I did all my VB newbie articles coding in bed, but gadget felt like kitchen work to me).
Betsy (on IM): Why won’t it recognize my gadget in IIS? I’m following the intructions!
Friend: Drag the gadget directory into inetpub, it has to see it there. Forget the fancypants permissions setting.
Betsy: Ok, it sees it now.
Segue again to kitchen table. Betsy IMing a friend whose been a dev for a long time:
It’s still not working!
Betsy: Hey, it’s working! Loookee here!
Betsy: I broke it! (Whams head on table)
Figure this went on from May through August. The gadget had a few lifecycle stages:
3. Refining the RSS formatting/bullets and that it doesn’t “stack” but wipes clean with every search. I discover the pain of memory leaks in IE.
Cut to kitchen table scene: BAM! BAM! BAM! (head thwacking)
Seek debug help from Tatham Oddie, half the planet away in Australia (he’s done TechEd demo sessions on how to write gadgets). He convinces me I’m not a madwoman.We escalate issue to gadget team. They fix some accidental misconfiguration in the gadget framework. It works again. Whew!
As consolation prize (maybe because my head is flatter now) they allow one of their developers to code review my gadget who has the coolest name next to Tatham’s – Javier Garcia Flynn.
He kindly says it’s not that bad, fixes the head-thwacking memory issue by moving functions outside the initialization section, shows me where I need to put functions to dispose, and notes something not in the SDK (you can see it commented in my gadget) about initializing base.
// The gadget framework now requires you to call
// your base method last. This is because this call may alert potential clients
// of this class to this instance’s existance and call methods on its interface
// when it is not yet fully initialized.
Specs to help you write your gadget – with less pain – are on the QnA blog:
6. We kick it live. Where I hope to the divine powers someone who is actually a developer, looks at it, looks at the spec, and decides to do a QnA mashup because as you know, it only takes 20 minutes and 15 seconds. For other people. 🙂