Skip to Content.
Sympa Menu

patterns-discussion - Re: [patterns-discussion] MDP feasibility questions (was: Messaging Design Patterns (MDP) reusability and QA)

patterns-discussion AT lists.cs.illinois.edu

Subject: General talk about software patterns

List archive

Re: [patterns-discussion] MDP feasibility questions (was: Messaging Design Patterns (MDP) reusability and QA)


Chronological Thread 
  • From: Ralph Johnson <johnson AT cs.uiuc.edu>
  • To: Al Boldi <a1426z AT gawab.com>
  • Cc: patterns-discussion AT cs.uiuc.edu
  • Subject: Re: [patterns-discussion] MDP feasibility questions (was: Messaging Design Patterns (MDP) reusability and QA)
  • Date: Tue, 14 Dec 2010 04:25:17 -0600
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/patterns-discussion>
  • List-id: General talk about software patterns <patterns-discussion.cs.uiuc.edu>



On Sat, Dec 11, 2010 at 9:46 AM, Al Boldi <a1426z AT gawab.com> wrote:

Can the MDP be used to replace the Observer Design Pattern?

The MDP is not a replacement for Observer.  They solve different problems, and can work together (or not).

Suppose you are programming in C++.  The big idea of MDP is to define one interface with one virtual function, which will have a name like handle() or execute(), or processMessage().  It has one argument, a "message", which might be a C++ object, or a string, or maybe an array of integers.  So, you take your beautiful object-oriented design, with a carefully designed set of interfaces, and replace each interface with a single interface with a single operation.  Of course, processMessage turns into something like a case statement, since you have to do something different for each kind of message.

Your natural reaction *should* be "This is crazy!  What a stupid idea!"   But it is not a stupid idea.  There are times that it is a really good idea.  The problem with the pattern descriptions is that it doesn't explain when this is a bad idea and when it is a good idea.

You would never want to use MDP for a small C++ program.  You might use it in a small program written in a non-object-oriented language, where you wanted to implement objects more clearly.  But its main use is in large programs, where you want to make sure that there is loose coupling between subsystems.  

Static typing doesn't scale.   Suppose your system runs on a hundred servers.  It uses hundreds of different interfaces.  Suppose you want to improve one of them by adding a new operation to it.  You don't want to have to reboot all your servers with a new version of your software.  You'd like to be able to add it to one and then gradually change one component after another to use it.   MDP lets you do this.  

MDP makes it easy to run components on different machines.  Or on the same one.  It works for any language, allowing non-OO ones to pretend to be OO.

On the other hand, MDP defeats static type checking.   It does not take advantage of OO features built into  language, so it can be verbose and indirect.  You wouldn't want to do it everywhere, but in the right places, it can be very effective.

>The MDP papers are mainly geared towards the messaging concept based on a realistic model. 
>I tend to place a lot of emphasis on the concept, abstraction and realistic model. In my opinion, 
>concept and interface are the main aspects in order to achieve a successful implementation.

I think your papers are not working.  Most people don't get the idea after reading them.   I think the problem
is that you focus too much on this "realistic model".  The problem is that the realistic model can be
interpreted in many ways, and MDP is only one of them.   Smalltalk programmers ALL use the same model.
When I read your paper for the first time, I thought you were just talking about the classic OO model that
we Smalltalkers have loved for 30 years.  You need to try to write things that cannot be misinterpreted.
I think you are trying to avoid having people say "You are crazy!" right away, but if they properly understand
what you are saying (and they have not seen this pattern used properly before) then they will say it.
They ought to say it.  When people say "You are crazy!" then you know that they are starting to understand.
Your job is to convince them that you are not crazy, that this is in fact often a valuable pattern.

-Ralph Johnson



Archive powered by MHonArc 2.6.16.

Top of Page