Skip to main content

All Questions

Tagged with
9 votes
2 answers
1k views

Granularity of Exceptions

I've run into a debate between a few friends and I. They prefer general exceptions such as ClientErrorException and ServerErrorException with detail as fields of the exception, whereas I prefer making ...
user avatar
7 votes
4 answers
404 views

Subtyping without adding state or behavior - Bad Practice?

Observation There are many Exception subtypes that don't have any added state or behavior. For example, ClosedByInterruptException code. Question Why is subtyping without adding state or behavior "...
Dioxin's user avatar
  • 953
5 votes
4 answers
2k views

IllegalStateException good practices

I know what IllegalStateException is for, but I wonder if in some cases I should actually use it or it's just a matter of design. Let's say I have a Tournament class that models a sports tournament ...
dabadaba's user avatar
  • 2,266
2 votes
3 answers
764 views

Why do assertions in Java need to get enabled?

I really like the concept of assertions in Java in the way how to use them. It's much easier than to write an if and then throw an Exception/Error. But the thing I don't understand is, why do they ...
piegames's user avatar
  • 261