Re: 7.0 wishlist?
- From: Andreas Leitgeb <avl@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: 14 Nov 2008 16:56:40 GMT
Joshua Cranmer <Pidgeot18@xxxxxxxxxxxxxxx> wrote:
Andreas Leitgeb wrote:That point taken.
Joshua Cranmer <Pidgeot18@xxxxxxxxxxxxxxx> wrote:Well, first off, the entire example is contrived.
The idea that changing the height does not change the width is what isAnd that is, what I consider an #1 example of a goofy contract.
violated.
But in any case, most people would agree, on only seeing the Rectangle
class, that assertContract should always succeed
I'm seemingly not "most people". I'd think about fix-proportioned
rectangles, where changing the width would auto-adjust the height
and vice versa. I have seen applications that behaved that way:
you grew/shrunk it in height, and it grew/shrunk in width proportionally.
And it made sense for these.
The point still remains, though, that structures from mathematics are
not directly transferable to code.
That point not taken. The only reason why a Square would not be a
Rectangle (in Java) would be a goofy contract attached to the Rectangle.
Imho, this is an entirely different pair of shoes than whether
commutativity is broken by side-effects of the operands.
Anyway, (to return one level back in the discussion), demanding
that (intValue + SomeClassInstance) could always be rewritten to
(SomeClassInstance + intValue) is goofy, too, not withstanding the
goofiness of actually writing such unreadable code that would
exhibit such side effects for the operands.
.
- Follow-Ups:
- Re: 7.0 wishlist?
- From: hzergel901
- Re: 7.0 wishlist?
- From: Mike Schilling
- Re: 7.0 wishlist?
- References:
- Re: 7.0 wishlist?
- From: Harold Yarmouth
- Re: 7.0 wishlist?
- From: Joshua Cranmer
- Re: 7.0 wishlist?
- From: Harold Yarmouth
- Re: 7.0 wishlist?
- From: Joshua Cranmer
- Re: 7.0 wishlist?
- From: Harold Yarmouth
- Re: 7.0 wishlist?
- From: Joshua Cranmer
- Re: 7.0 wishlist?
- From: Harold Yarmouth
- Re: 7.0 wishlist?
- From: Joshua Cranmer
- Re: 7.0 wishlist?
- From: Harold Yarmouth
- Re: 7.0 wishlist?
- From: Joshua Cranmer
- Re: 7.0 wishlist?
- From: Harold Yarmouth
- Re: 7.0 wishlist?
- From: Joshua Cranmer
- Re: 7.0 wishlist?
- From: Andreas Leitgeb
- Re: 7.0 wishlist?
- From: Joshua Cranmer
- Re: 7.0 wishlist?
- From: Andreas Leitgeb
- Re: 7.0 wishlist?
- From: Joshua Cranmer
- Re: 7.0 wishlist?
- Prev by Date: Re: Initializing variable style question
- Next by Date: Re: Initializing variable style question
- Previous by thread: Re: 7.0 wishlist?
- Next by thread: Re: 7.0 wishlist?
- Index(es):