Timeline for How to warn other programmers of class implementation
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 16, 2016 at 15:53 | history | edited | Brian Agnew | CC BY-SA 3.0 |
added 12 characters in body
|
| Apr 16, 2016 at 15:52 | comment | added | Brian Agnew | You'll note that the exception throwing is one possible option and I go on to elaborate on my preferred option - making this compile-time safe. I've edited my answer to emphasise this | |
| Apr 16, 2016 at 15:50 | comment | added | displayName |
I am not down-voting this answer but it is not really a good answer. By just throwing IllegalStateException or InvalidOperationException out of the blue, a user will never understand what he did wrong. These exceptions shouldn't become a bypass to fixing the design flaw.
|
|
| Apr 16, 2016 at 12:52 | comment | added | miroxlav |
Note: In .NET, InvalidOperationException is promoted by the Microsoft to be what you called IllegalStateException.
|
|
| Apr 15, 2016 at 3:44 | comment | added | Thomas W | Good answer -- 2 good options in a nice succinct answer. Other answers above present type-system gymnastics which are (theoretically) valid; but for the majority of cases, these 2 simpler options are the ideal practical choices. | |
| Apr 14, 2016 at 12:16 | history | answered | Brian Agnew | CC BY-SA 3.0 |