Friday, June 30, 2006

Mobile Objects and Ice Cream

So I've been taking the time lately to read through Rocky Lhotka's new CSLA.NET 2.0 book, Expert C# 2005 Business Objects. It's a great book and in it, among many other things, he talks about the concept of mobile objects. In short, mobile objects are objects that have the ability to move from one location (process or machine) to another. In each location they can behave in an object-oriented fashion, interacting with the services that that location has to offer. Essentially, the concept of mobile objects is one of the ways the CSLA.NET framework solves the age-old problem of doing OO within a distributed application.

Anyway, I caught myself thinking in mobile object terms the other night when I got a hankering for a bowl of ice cream. I found myself upstairs in the kitchen with an empty bowl and a spoon. The problem was that the ice cream was in our second refridgerator in the basement. Rather than bringing the ice cream container up to the kitchen (only to have to bring it back down again when I'm done), I decided to implement a mobile object. I was the end user and my bowl was the object (I suppose my spoon was the user interface). I wanted to make my bowl mobile and send it to the basement to be filled with ice cream. Since it happened to be father's day, I asked my son if he would be willing to execute the fetch. Being a good boy, he ran downstairs with my bowl, performed the data-centric operation of getting the ice cream out of the ice cream container (the data store) and filling the bowl. He then made the bowl mobile again by returning it back to me in the kitchen. With the filled ice cream bowl I performed some UI-centric business logic by pouring on a generous serving of Magic Shell. And then I ate it.

See, mobile objects really do work!