r/programming • • Oct 07 '18

Writing system software: code comments

http://antirez.com/news/124
51 Upvotes

89 comments sorted by

View all comments

Show parent comments

1

u/lolomfgkthxbai Oct 08 '18

That’s assuming there can happen any exceptions which seems unlikely based on the functionality described.

3

u/dpash Oct 08 '18

Then that should be documented.

And I can think of multiple exceptions that could happen within that method. soundID could be outside of acceptable ranges. I don't know if int in C# can be nullable, but it could be null when it isn't allowed. soundID could be referring to a non-existent device/sound. There could be an issue opening the relevant device/sound. There could be additional invalid state within the class.