I’ve been looking at widgets and mashups a fair bit recently and one of the questions that comes up is around what the best approach for widgets is; should a single widget do a lot, or should multiple widgets be used instead. Obviously every situation is different and there may be reasons to favour one approach over another at different times. The following example occurred to me which might show what the pros and cons are.
Say I was developing a clock widget. There are already Google gadget clocks, so it seems like a reasonable widget to want to have. I could split different parts of the clock across multiple widgets, all sending/receiving events to coordinate the display of a particular time. In the example below, there’s a widget for the hour hand, minute hand, second hand, and whether it’s the morning or afternoon. There’s nothing technically wrong with the resulting mashup – I can tell what time is being shown – but using that many widgets does not really add any value, and there’s not a lot of space left for anything else on my screen.
At the other end of the scale, the example below uses a single widget to display the time. On its own, there wouldn’t be much point using a widget to show the time. It might look funky (well, if any time had been spent making the clock look better than my quick sketches) and I could move it around but you could do all that with a bit of javascript and style sheets on any old web page. Except, if the widget sends and receives events, you can use it in a mashup. There’s plenty of room for other widgets, and in this example selecting a person shows where they are located and their local time, so I know if it’s a good time to phone.
Obviously a clock is a pretty specific, and simplistic, example. There’s a pretty good illustration in the Enterprise Master Data Management book (Figure 2.3, page 73) which shows the two extremes in more general terms:
The first clock was modular, but it was tightly coupled; there were several pieces but only one usage.
The second clock, and other widgets in the mashup, were modular and loosely coupled; there were several pieces and many usages.
(Now i just need to think of an example of a widget that does too much!)
Pingback: I’m back « dale lane