To build an OpenSocial widget, we really need to start by building a Google Gadget. And Google Gadgets, at their simplest, are self-contained XML files. To give you the simplest example, here's a "Hello World" Google Gadget I created, using the Google Gadget Editor, an inline, JavaScript-powered editor.
Coding Library:
Javascript/AJAX
More OpenSocial Resources:

