Skip to main content
9 events
when toggle format what by license comment
Feb 5, 2014 at 18:17 answer added Andy Birchall timeline score: 0
Dec 12, 2013 at 12:55 comment added aknon PreConditions, Postconditions and Invariants are Conditions formalised by a programming contract ( Design by contract ). <br> Please see my blog design-principle-pattern.blogspot.in/2013/12/…
Dec 23, 2011 at 13:14 vote accept BizTuk
Dec 21, 2011 at 3:40 comment added Keith Nicholas When your system supports pre / post conditions and invariants, then the rectangle / square thing kicks in. But in many language those constraints aren't specified and most likely a square can be used instead of a rectangle. (maybe, sometimes the in-variants/post and pre conditions are simply assumed and relied on)
Dec 21, 2011 at 3:07 comment added BizTuk If the semantics has nothing to do with the principle, would you mind explaining me the Rectangle/Square example?. The mayor complain about this that i've found so far is that if you use a Rectangle obj = new Square() and assign height an width without previous knowledge that the object is an Square, you will get an unexpected result of the function getArea() just because you think a Rectangle has 2 different values for Height and Width. Thanks in advance
Dec 21, 2011 at 2:55 comment added Keith Nicholas Polity, implied semantics from method naming doesn't really come into it. It's from the type definition.
Dec 21, 2011 at 2:53 comment added Polity your function has no contract in it's naming or outlook whatsoever, an implementation returning an arbitrary value is therefore perfectly acceptable. You would get in a gray zone however if you specify a contract in the name of the function, like: int Add1ToArgument(int argument) { ... }
Dec 21, 2011 at 2:49 answer added Keith Nicholas timeline score: 2
Dec 21, 2011 at 2:46 history asked BizTuk CC BY-SA 3.0