A criticism of Java is that it has a MessyExceptionHierarchy. But so does every hierarchy (not just exceptions) that I've seen that goes through several iterations and always keeps backward compatibility. MicrosoftFoundationClasses also suffer(s) from this. This is due to the fact that software development, as a human discipline, is a constantly changing and improving process. Also, all abstractions/conceptualisations are, well, abstractions, and are simplified, and therefore do not fully reflect the underlying reality. It doesn't matter how well something is designed; it invariably needs to be refactored at some stage (as things improve and change). Does anyone know of any real world systems that have overcome this problem? -- PeterForeman ---- Perhaps part of the problem is the hierarchical approach to exceptions? After all, most exception classes contain the same members. Only a handful actually describe the exception. This is just speculation, but perhaps the idea is mess it up some more? Play with inheritance and interfaces. Make all your functions derive their own exceptions from sensible base classes - like a SubStringIndexOutOfRangeException that derives from IndexOutOfRangeException, which derives from RangeException, etc. - one exception class for every possible error, but use extensive subclassing to deepen the hierarchy. Of course, the problem is that no mainstream language offers any mechanism for constructor-reuse, so making exception classes is always verbose - if defining delegate classes were that painful, nobody would use them. With interfaces in cases where similar but unrelated exceptions are to be grouped together (ISubStringExceptions). ---- I have been struggling with what to do with exceptions. Right now, I have the thinking that I usually catch the exceptions in my objects and throw a RuntimeException with the error message so if it happens, it will fail quickly. I think this is in line with DoTheSimplestThingThatCouldPossiblyWork because I don't do any fancy handling unless I need it. Any thoughts? -- TimBurns ThrowDontCatch ---- Have you considered that maybe formal exceptions are a flawed idea that simply complicate languages and libraries? ''It is very easy to show that the availability of exceptions make many coding tasks simpler and the code much more understandable. That doesn't mean that exceptions *must* be used in all cases, but that having them is useful in many cases'' -- JuancoAnez Could you provide some examples, by chance? ---- In this Artima interview http://www.artima.com/intv/handcuffs.html, AndersHejlsberg, one of the main designers of CeeSharp, talks eloquently against CheckedException''''''s. -- JuancoAnez ---- See also: LimitsOfHierarchies