Tuesday, December 6, 2011

Diagramming message flow

So today I decided to look to see whether I can find ways of designing systems from a message-oriented point of view.

First strike against the googlebase was the UML2 Communication Diagram (Scott Ambler’s site – agilemodeling.com)

So let me take a look at this for a moment. How many ways do I hate this diagram?

Well the good part is that you can see a sequence of communication. But that’s where it stops. It’s very granular (see the label about “series of getter invocations”). The communication is about methods called – not about messages exchanged. But hang on – I’m forgetting my OO roots – methods are messages – or the poor remnant of what messages were originally intended to do.

So in a sense, the messages are shown there, but only in miniscule detail. This diagram shows meta-flow, which you definitely need for message-oriented programming, but it’s still not message-oriented because there isn’t enough detail in about the messages. There isn’t much detail in the object boxes either, but the focus is definitely on the objects.

Next up then, (as recommended by Steve), the humble Sequence diagram (of which I am a big fan)

Ok, so here we have a nice clean diagram showing the flow of messages between instances of objects. And I very much like this – it puts a lot of focus on the messages themselves. As much as 75% of the diagram space is message flow. Of course, the main highlighted units are still the object instances themselves, and their lifelines. But it’s closer…

And I suppose the problem is that much of what I am seeing is about flow and sequence, not about the messages themselves. This is because the messages are seen as “belonging” to the objects (i.e. the “methods” belong to the class of an object). In reality, Dr. Kay’s take on messages is much more independent from the “receiving” objects themselves. To capture his principles, we would have to have a diagram which treats the “receiving” objects as equivalent to the “message” objects.

That gives me an idea! But enough for today. Till tomorrow. Perhaps Lee will have blogged by then.

No comments:

Post a Comment