From mtheroux@ccs.neu.edu Wed Feb 26 11:38:44 1997 Sender: mtheroux@ccs.neu.edu From: Michael Theroux To: lieber@ccs.neu.edu Subject: Law of Demeter Violation Would this violate the law of demeter: this.get_giv().get_argClassList().elementAt( i ) The .elementAt( i ) may violate it, however, that is not something we setup in our class dictionary. Thanks, -Mike- From lieber@ccs.neu.edu Wed Feb 26 11:59:31 1997 Mike: the Law of Demeter is not about class dictionaries, just about OO. Yes, this would violate the Law of Demeter, so simply mark it: // violation of LoD When your propagation pattern tool is complete, it will be easy to remove such violations. Also you could argue, that the Vector class will not change and therefore the violation is ok. -- Karl From dougo@ccs.neu.edu Wed Feb 26 12:54:18 1997 To: lieber@ccs.neu.edu cc: mtheroux@ccs.neu.edu, com1205@ccs.neu.edu Subject: Re: Law of Demeter Violation > Would this violate the law of demeter: > > this.get_giv().get_argClassList().elementAt( i ) > > Yes, this would violate the Law of Demeter, so simply mark it: > // violation of LoD I prefer to write expressions like this as: giv.get_argClassList().elementAt( i ) This seems not to violate the spirit of the LoD, because "giv" can be thought of as a local variable. Also, if argClassList were instead an array of Object, you could just write it as: giv.get_argClassList()[i] which would (I think) comply with the LoD. --Doug