Timeline for Implementing an interface when you don't need one of the properties
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 31, 2015 at 7:49 | comment | added | Andy | What if the correct value was unknown upon compile time? | |
| Dec 30, 2015 at 14:46 | comment | added | Jon Raynor | I don't now how the value would be incorrect when your the one implementing the interface! It's your implementation, it can be whatever you want. | |
| Dec 30, 2015 at 0:39 | comment | added | Sophie Swett | If there are no possible correct return values, it's better to throw an exception than to return an incorrect value. No matter what you do, your program is going to malfunction if it accidentally invokes this property. But if you throw an exception, then it will be obvious why it's malfunctioning. | |
| Dec 29, 2015 at 23:23 | comment | added | user22815 | This breaks LSP: see Jimmy Hoffa's answer for an explanation why. | |
| Dec 29, 2015 at 23:19 | comment | added | Lightness Races in Orbit | Why? How is returning incorrect data any better? | |
| Dec 29, 2015 at 21:58 | history | answered | Jon Raynor | CC BY-SA 3.0 |