Sunday, September 5, 2010

The subjects removed Java exception?

NealGafter asked a number of Java developers will be asked the question: "Java language and platform is not unusual subjects (Checked Exception) do?"

He will be the argument against abnormal subjects summarized as follows:
Abnormal use of the subjects has been controversial. Many criticize the Java exception of subjects and described them as a failure in software engineering experiments. In fact, the subjects may lead to abnormal API become very complicated, the program with the exception checking code mixed together, just to the compilation by the compiler. While others are considered abnormal subjects is a good language feature but are misused, even in the JDK in as well. Since there is so bad "expert" model, and we expect ordinary Java programmers can do much good?


The discussion that followed it has been polarized in this topic, some of which represent a view, such as the following point of view are from the "anonymous", Christian Plesner Hansen, Henri and Cedric:
You do not know the state of nature is what the code looks; people catch the root exception and then throw six or seven special exception, or use many exceptions to include business logic and then throws Exception, or catch exceptions and then throw an error code, or to empty catch blocks, or catch NullPointerException.

I started a few months ago against the abnormal subjects. I reported a RFE (# 6376696) and the relevant officers to discuss and Sun. They almost no interest in it, and eventually mark it as "not Fix" and close the [... ...] subjects exception that does not work. I guess I like the subjects are unusual among that small allocation of a [... ...] remove the abnormal subjects would encourage more bad code, because when an error occurs the application will directly crash. And this will not encourage developers to think of the consequences of errors.

I must take exception to count in that subjects very important to build large-scale API side. Of course, they may be misused, but not unusual in many parts of the same subjects have also been over-used.
Well, there are subjects with abnormal Why? It really is not always a good way to be the proper use of, or failure of a trial should be terminated?

This also raises a more general question - removed some features from Java. If we are bent on adding features to the language, without deleting some of them, then the language will only become more complex. Is it possible to remove some features, thereby reducing the complexity of the language, without prejudice to the language itself? Should we get rid of those deprecated methods and upgrade the old API, but not so sacrosanct to see it backwards compatible?

No comments:

Post a Comment