Applying the Law of Demeter

Peter Hansen peter at engcorp.com
Wed Dec 11 22:55:38 EST 2002


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



More information about the Python-list mailing list