Wednesday, August 23, 2006

plasma wednesday: data engines

so here's our first little plasma update, it being wednesday. just to warn you all, it's going to start out a bit boring. ok, probably a lot boring. since for the next couple weeks i'll be working on greasy guts rather than luscious lips. so to speak.

one of the lessons learned with kicker was that some things are not so trivial under the hood (think: taskbars, pagers, weather reporters) and so if you marry them too tightly with the display ..... you end up with very few alternatives. in fact, virtually every taskbar replacement written for kicker was a fork of the original taskbar. what makes that doubly interesting is that the task manager (aka "windows bean counter") was abstracted out for use in other user interfaces. the pager, kasbar and the taskbar all used it. but still, people would generally start by forking the taskbar.

this was rather annoying since most of these forks were to provide new cosmetics. bug fixes in business logic didn't get shared or passed around and i truly think a lot of possible innovation was stunted by the bar one had to clear and the lack of headroom left once cleared.

looking around, this pattern repeated a lot. unless one looks at superkaramba and system monitors. holy crap are there a lot of them! so why so many monitors and why so few taskbars? is it that monitors are simply sexier? probably that's part of it .. but certainly not all of it.

something superkaramba did was provide simple access to hardware data. and then it provided simple access to display widgets you could plug that data into. or you could write your own. i think this is the true reason for the explosion of such widgets; for even though there are other categories of superkaramba widgets, this was the class that really took off.

so in plasma we're going to deliver all business logic sets wrapped in a neat little bundle. and we're going to call them "data engines". why? because that was the name that occurred to me at the time and now i'm stuck with it. ;)

we're also going to provide sinks for these engines called "data visualizations" which are display widgets that accept data in various formats (QVariants, actually). and you can mix and match these data engines and data visualizations to your liking. you can also write new engines and visualizations and share them with others.

there's a basic introduction. using the data engines from a plugin (or "plasmoid" as they seem to have been christened) is pretty simple. in both javascript and c++ it would be:

loadDataEngine("windows")


doing it manually would look like:

Plasma::Interface::self()->loadDataEngine("windows")


but then you'd have to handle unloading it yourself. the data engines are reference counted and shared between plasmoids which fits the pattern: the engines are the models, the visualizations are the views.

enough for tonight ... on friday we'll look at writing a simple data engine, and on wendesday we'll look at writing a simple data visualization and hooking them up. from there .. who knows =)




when i started writing this entry, the p-man was in the bathtub and i heard an excited squeal, "this is gonna be crazy!" it's moments like that which make a parent cringe and smile simultaneously.

i went for a run with the soccer ball at a neighbourhood park this afternoon and a clean cut young kid on a skate board, 10 years old, came up and asked if he could play with me. we spent about 45 minutes kicking the ball around, the last 15 or so with him taking shots on goal. i'm a lousy goalie so it was fun for him ;) he kept asking questions; all sorts of questions ... asked if i was from canada (apparently i don't look like it); if i was on t.v.; if i played on a soccer team; if i had been to other countries; if i was married, had a kid ... sometime during the game of inquisition soccer i noticed his shoes were worn through at the toes. either he loves those shoes (and his mother chokes every time he insists on wearing them) or he's got it hard at home. he asked if i'd come to the park again sometime, and i said yeah ...

i hope he's sleeping as well as the p-man is right now...