Applying the Law of Demeter

John Ochiltree jo at johnochiltree.uklinux.net
Thu Dec 12 04:02:02 EST 2002


"Peter Hansen" <peter at engcorp.com> wrote in message
news:3DF808BA.BCEFF9C8 at engcorp.com...
> beno wrote:
> >
> > I'm unskilled but well studied in OOP and somewhat in AOP. I'm
developing a
> > shopping cart building on the PEAK framework for integration with Zope3.
I
> > have a snippet from a sequence diagram below. Would those of you more
> > skilled than I please offer suggestions on how to clean this up, without
> > violating the Law of Demeter? I'm hoping that by so doing I can get the
> > gist of how I can improve the entirety of my UML.
> >
> > snippet:
> >
> > ClientData.Utilites() has method
> > assembleGatewayData(paymentVehicle : int, **customerCreditInfo: dict,
> > **gatewayData: dict)
>
> [snip other snippets]
>
> Uh, what language is that?  It's certainly not Python, so are you even in
the
> right newsgroup with this?
>
> Also, the description of the problem is unclear, and the terminology
> used is confusing.  For example, "item X has method A which it
> calls upon item Y".  That's paraphrasing what you said about
> ClientData.Utilities() and how it does something with Payment.TheMoney().
> In object-oriented programming, you wouldn't say that the first
> thing "has" the method if it "calls it on" the second thing.
> Do you mean the first thing calls the method that the second thing
> has, or something else?
>
> -Peter

This is the first bit of this thread I've seen so I might be off the mark
here. The 'language', Peter, is UML - The Unified Modelling Language. It is
NOT a programming language. 'has a' and 'is a' are part of the notation for
describing relationships. I think it's in this news group because the
development will be in Python based on Zope.
If anyone would care to send me the original postings I'd like to have a
look.
Also, I've never come across the 'Law of Demeter'. is it something like the
succession of the priests of Diana :-) Please enlighten me.

TTFN John





More information about the Python-list mailing list