Campbell Ritchie wrote:How much evidence is there for Odersky Spoon and Venners to argue that so many implementations of equals are wrong?
And you can get as much heat rather than light about whether to throw NPE or a different Exception. Nearly as good as spaces vs tabs for indenting
Winston Gotkowski wrote:. . . Vaziri, Mandana, Frank Tip, Stephen Fink, and Julian Dolby. “Declarative Object Identity Using Relation Types." In Proc. ECOOP 2007, pages 54–78 . . .
You weren't. But I just remembered the discussions we had here about which Exception to throw for nulls.
I don't think I was saying "don't throw NPE". . . .
Campbell Ritchie wrote:And you can get as much heat rather than light about whether to throw NPE or a different Exception.
Stevens Miller wrote:I don't much care which exception a programmer chooses, provided that programmer is consistent about their choice...
Winston Gutkowski wrote:My normal rule of thumb is that if I can naturally call a method on the "possibly null" object in the first line of a method, then I let nature take its course; otherwise I check for it explicitly - and in that case I throw an Exception with an explicit message. But whether it's NPE or IAE or even something like IllegalStateException, I really don't care too much.
Stevens Miller wrote:Continuing in this (more or less) related sub-thread: how do you guys feel about The Law of Demeter?
Winston Gutkowski wrote:I don't actually think about it very much because it seems to be a natural by-product of loose coupling...
Stevens Miller wrote:Some of those encounters take it as gospel, but some point out that rigid obedience to LoD can lead to the proliferation of wrappers for, ultimately, no very good reason. So the question really becomes, for me, what purpose does LoD serve? The preservation of loose coupling is a good answer to that question, and one that, to me, needs no further justification.