I recently finished a book called “Object Technology: A Managers Guide” that my friend Max Porges recommended to me. In all it was a very nice high-level overview of what OO technology is and does. It certainly was not a nuts & bolts, syntax-level book (as the name probably confirms) but I still think it has value for programmers in that it reels in all the relevant concepts in a nice summary. I won’t summarize the content of the book as you can get that from amazon, but one example really gave me an “aha” moment and I wanted to cover that here.
I have always been awed by how UPS can successfully route millions of boxes each day to where they need to be. That feat alone is stunning but add ontop of that all the constraints they deal with limitations like physical volume of the various shipping vessles, the weight limitations on their airplanes, the fluctuating price of gasoline, right down to the changing road and weather conditions and blockages that affect their vehicles – how on earth do they seem to roll with the punches so effortlessly and choose optimal routes for each package? If you think about it, it’s an interesting challenge because there are infinite permutations of how to group the boxes and choose the routes and there may be multiple “right answers.” The amount of engineering that must be involved a system that accomodates this level of complexity and variance from that many unpredictable, real-world circumstances is incredible and I’ve had trouble conceiving of where I would even begin if I had to design such a system. That is until I read the above book… It’s actually a mind-blowingly simple concept made possible via OO design once you consider all the packages objects. Here is the key:
Each box is a greedy, self-serving object operating under freemarket conditions and abiding by a predetermined set of rules and priorities as far as tradeoffs with respect to price/speed/reliability. I think of it in terms of that one reality show that seems to be so popular (The Great Race?) -they give ten couples $100 and tell them each that they need to get themselves from starting point A to destination B in 12 hours and await instructions there. The couples have a ruleset they must abide by (both from the show’s producer and from society if you think about it – ie. carjacking should not be a viable option). They come up with the most effective strategy of getting from A to B given their resources at any given moment and this can change, they can even partner with other teams if the circumstances provide that such arrangement would be self-serving and mutually-beneficial. But it’s crucial that all decision-making capability is distributed to the level of the couples. If there were to be one central authority trying to call out the plan for best strategy for every couple at every given moment, first it wouldn’t be interesting but most importantly it would be a completely unmanageable mess.
According to the OO book above, UPS undoubtedly employs a similar strategy in how they route their packages. They make them into greedy, self-serving individuals trying to get to where they need to be as cheaply as possible and as quickly as possible. Let the packages figure out what route is best given the paramters and the conditions. If you expand this concept further, their planes are probably simultaneously calculating tradeoffs for optimal weight loading and space management given the destinations of the packages that have chosen them. And one level further, if UPS is like Southwest Airlines, there is some forethought and forecasting going into their purchase and allocation of fuel and they’ve probably done monte carlo simulations on the value of buying oil futures at any moment. Especiall w/ oil at $60/barrel and with a fleet of gas-guzzling machines as large as theirs, there is no doubt in my mind that they’ve invested considerable resources into building intelligence into the “selfish” fuel reserve object that determines the most effective way to buy and distribute their gas. Of course these are all just speculations on my part and I don’t actually even know anyone who works at UPS- I’m just a big fan of how smoothly their operation always seems to run given the complexity of what they juggle.
Read that book if you get a chance. There are some other examples in there which are equally as inspiring, that one just stood out for me as being the “aha” of the month.
© 2005 Lights Out Production – All Rights Reserved Worldwide