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.
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!)