This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Posted by Mike Mannion on 22 Jun 1998, 7:50 AM
> Seems like they could have made Unchecked an empty
> interface that unchecked exceptions implement, instead
> of relying on position in the single inheritance hierarchy.
> But, things being the way they are, we'll have to live
> with homogenous (either all checked or all unchecked) families.
I don't believe that class hierarchies are the best means to describe "families" of related exceptions, and I have found the existing approach to be acceptable.
Most of the time, unchecked exceptions contain significantly different information to their checked counterparts.
After all, the one form generally purports misuse of a class (programmer error), whilst the other form does no such thing.
So for me, the natural way to group related exceptions (checked or otherwise) is to use packages.
By the way, it is great to see someone else talking about "Design by Contract" (DBC) in a Java context.
DBC is a much underrated design paragigm which the majority of Java designers/programmers would do well to look into.
Far from being a methodological ball and chain, DBC enhances a design's precision by completing the specification of the interface.
Improved quality and productivity is the major benefit.
Roy Phillips and myself have written an article on DBC and Java, which is scheduled to appear in September's JavaReport.
In it, we introduce DBC as a concept, and then discuss the ways (and the problems) of achieving DBC support in Java.