163 reputation
16
bio website ganggarrison.com
location
age
visits member for 2 years
seen Oct 7 at 23:04

Feb
26
awarded  Constituent
Feb
25
awarded  Caucus
Jan
7
awarded  Scholar
Jan
7
accepted “Programming error” exceptions - Is my approach sound?
Nov
23
comment “Programming error” exceptions - Is my approach sound?
This goes against popular advice though - specifically, Effective Java, 2nd ed, Item 62 is "Document all exceptions thrown by each method". In fact, Bloch acknowledges that unchecked exceptions are generally for programming errors, but that they should be documented carefully too, since that is "the best way" to document the preconditions of a method. I am not sure whether I agree though. If I document the execptions, I make them part of the interface contract and may have to add code to make them remain the same if my implementation changes.
Nov
23
comment “Programming error” exceptions - Is my approach sound?
I understand the need for documenting which values are allowed, but if you see a function performReadCommand(ICommand cmd, int replySizeBytes) - would you expect that null would be acceptable for cmd, or a negative value for replySizeBytes? IMO documentation would only be necessary if those values actually were allowed, and you should probably address whether 0 is valid for replySizeBytes.
Nov
19
awarded  Supporter
Nov
19
awarded  Teacher
Nov
19
revised “Programming error” exceptions - Is my approach sound?
Added another part of the question that was present in the original but lost in the last edit
Nov
19
answered “Programming error” exceptions - Is my approach sound?
Nov
19
awarded  Editor
Nov
19
revised “Programming error” exceptions - Is my approach sound?
Splitting off my own thoughts into an answer
Nov
19
awarded  Student
Nov
19
asked “Programming error” exceptions - Is my approach sound?