[PartÂ 3 in a 5 part series titledÂ "How to build a widget"]
You thought of an idea.Â You chose the tech.Â Now it is time to get busy.
Part 3) – Creating the widget.Â
Widgets are self contained mini-websites and have to be treated the same way you would go about creating a website.Â
[Quick definitions:Â The "widget user" refers to the person grabbing the widget, while the "page visitor" refers to theÂ person viewing the widget on the widget user's page/blog]Â
First, determine if the widget will be static or dynamic.
Static widgets are widgets that are exactly the same for every widget user that grabs the widget code.Â An election countdown widget would be an example of a static widget.Â The widget developer (you) only has to create the desired effect and code it without relying on any dynamic data.Â
Dynamic widgets are widgets that change for each widget user embedding the code.Â Â MyVGift.comÂ is an example of a dynamic widget.Â The widgetÂ user is each assigned a unique ID that is rendered to the object tag at the time of the web pageÂ is served.Â The widget then uses the ID to pull data from a web service to determine the widget user’s Virtual Gift list.
Static widgets are normally less complicated and can be deployed without much complication.Â Dynamic widgets require external sources supporting and possibly storing data for the widget.
Second,Â allow customization.
Someones blog or Myspace page is an expression of themselves.Â Why would they want to install your ugly neon pink widget on theirÂ green background Myspace page?Â GiveÂ widget users the ability to customize the size/shape/skin/wording of your widget.Â Â Page visitors do not want to have your widget stand out (in a bad way) on the widget users page.Â Give the widget users the option to allow the widget to blend into the look and feel of their site.
Finally,Â make your widget friendly to the widget’s users page/blog.Â This means make it small and available.Â
Nobody wants to install a widget on their blog that is 2.3 megs.Â This will kill the experience for the page visitor.Â Generally try to make your widget size under 100K.Â Also make sure you host your widget on a respectable server.Â Your widget is going to be served up every time the widget user’s page is served.Â This is orders of magnitude more times then if you were just hosting a web site on your server.Â If a widget user installs your widget and gets 3k hits a day onÂ their site, then the widget has to be able to be served up 3k times without any slowdown (plus support all of the other widget users).Â Â Â Â Â
Next – PartÂ 4 -Â Deploying the widget.