News for hackers. Stuff that matters.
Re:Inheritance Often Doesn't Make Sense by niklasjansson on Saturday March 17, 2018 @11:26AM (#16607353)
So this behavior is reasonable?

Rectangle r=getRectangle(); r.width=1; Assert(1, r.width); //passes r.height=2; Assert(1, r.width); //fails or passes depending on subclass

Re:Inheritance Often Doesn't Make Sense by Paul_Dirac on Monday March 19, 2018 @07:14AM (#16617556)
The problem is that the square is a rectangle in the mathematical sense: a rectangle with ANY additional constraints while code which uses a rectangle expects a rectangle with NO further constraints.

I believe the right choice is to have an AbstractRectangle class representing the rectangle with any further constraints and Rectangle class representing the rectangle with no further constraints.