From: Markus Date: 2004-10-07T02:22:01+09:00 Subject: Re: quality of error messages I agree with almost everything you said. However, I must object to one point: On Wed, 2004-10-06 at 09:43, Eivind Eklund wrote: > ...the code example you showed elsewhere in the thread had > two a slight design smells: > ... > - The method chaining you do violates the "Law of Demeter" - don't dot > the return value from another method. This is, in my opinion, a misreading of the Law of Demeter, which specifically allows sending messages to objects you create or "own". There is really no correlation between method chaining and the Law of Demeter since the intermediate objects in the chain may well be friends, but in other circumstances they may not. It depends on the details of the individual case. In many instances, _not_ chaining methods leads to worse smell, as it creates lots of set once / used once temporary variables (or worse, reused for multiple purposes placeholders). For example: bottom_6 = scores.sort.reverse.values_at[0..5] smells much better than sorted_scores = scores.sort reverse_sorted_scores = sorted_scores.reverse bottom_6 = reverse_sorted_scores.values_at[0..5] -- Markus