Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Charting Unknown Waters in JDK 1.4 : Page 3

Java Specialist Dr. Heinz Kabutz has been digging through the classes in the java.util.* package of the JDK 1.4. This article highlights some of the gems he discovered right away.


advertisement
RuntimeException Specifications: An Admission of Guilt?
All over the JDK 1.4 java.util.* package, I have noticed that the RuntimeExceptions are now also specified in the @throws clause of the JavaDocs. Bruce Eckel and I exchanged quite a few e-mails debating the current exception model. We ended up wondering whether it perhaps was fundamentally flawed. For example, java.io.IOException has more than 30 subclasses that each could be the actual exception being thrown. What good is that? When you see that a method throws IOException, what is actually being thrown and how do you deal with it?

I think that checked exceptions should be scrapped. They don't work. They cause bad code, such as the following:

while(true) { try { Thread.sleep(1000); // do some other work } catch (Exception e) {} }



Checked exceptions are responsible for more sloppy code and bugs than any other construct in the Java language. C# does not have checked exceptions, neither does C++. Why does Java continue to be encumbered by them? I think declaring as comments the runtime exceptions that a method could throw is a step in the right direction.

More to Come
Look for other interesting little snippets I've discovered in my upcoming articles.

Editor's Note: This article first appeared in Dr. Kabutz's The Java(tm) Specialists' Newsletter under the title Charting Unknown Waters in JDK 1.4 Part I. To subscribe, send an email to subscribe@javaspecialists.co.za.



Dr. Heinz Kabutz owns Maximum Solutions, a Cape Town-based consulting firm that specializes in Java technology. He spends the majority of his time programming Java OO applications and also advises companies that wish to embrace Java as a technology. He has been a lead programmer in one of the first big Java developments in South Africa, now consisting of almost 600,000 lines of Java code. He has been programming in Java since 1997. He can be reached at heinz@javaspecialists.co.za.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date