Timeline for In what curricula are "rectangles" defined so as to exclude squares?
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 5, 2021 at 6:19 | comment | added | Dewi Morgan | (not a criticism of your answer, just a pondering on whether received wisdom about squares makes sense from a programming perspective, and how I could implement it) | |
Jun 5, 2021 at 5:40 | comment | added | Dewi Morgan | This sounds programmatically fraught. We want Square to be passable to any fn that takes any quadrilateral that Square can be. But this breaks: Rectangle.getTwoLongestSides() returns a pair of opposite sides. We could pick two arbitrary sides, but that assigns an orientation to Square that it should not have. And Kite.getTwoLongestSides() is expected to return two adjacent sides, so what do we do then? By allowing Square to be other things, we have to handle all these bizarre edge cases. Square has properties the others don't, and vice versa: it's just a bad fit for inheritance. | |
Mar 20, 2018 at 13:32 | comment | added | BCLC | Adam, I'm guessing there's some function 'Square' that takes one argument and another 'Rectangle' that takes two arguments that have to be distinct. Why not have a function 'Oblong' instead of 'Rectangle' ? | |
Mar 20, 2018 at 13:21 | comment | added | Adam | What would that solve? | |
Mar 19, 2018 at 15:30 | comment | added | BCLC | Wait why not just use oblong for pairs of side lengths? | |
Mar 17, 2018 at 15:09 | history | answered | Adam | CC BY-SA 3.0 |