Applying the Law of Demeter
Max M
maxm at mxm.dk
Thu Dec 12 07:54:26 EST 2002
More information about the Python-list mailing list
Thu Dec 12 07:54:26 EST 2002
- Previous message (by thread): Applying the Law of Demeter
- Next message (by thread): Applying the Law of Demeter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
John Ochiltree wrote: > "Peter Hansen" <peter at engcorp.com> wrote in message > Also, I've never come across the 'Law of Demeter'. is it something like the > succession of the priests of Diana :-) Please enlighten me. It's about hiding implementation behind an interface. so instead of going through a native data structure direcly by writing:: mb = MailBox() mb.mails[1].print() You implement a function that hides the data structure, a bit like this, instead:: mb = MailBox() mb.printMail(1) This makes for more robust code, that is easier to refactor later on. It is a short and simple example I hope can be understood. If not, try Google instead ;-) regards Max M -- hilsen/regards Max M http://www.futureport.dk/ Fremtiden, videnskab, skeptiscisme og transhumanisme
- Previous message (by thread): Applying the Law of Demeter
- Next message (by thread): Applying the Law of Demeter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list