![]() |
|||
![]() ![]() |
![]() |
|
![]() |
FUD (fear, uncertainty, and doubt)There is a certain amount of fear, uncertainty, and doubt about using undocumented Java classes. Is it safe? To borrow terminology from AIDS educators, theres no such thing as safe or unsafe Java. All Java programs are safe or less safe with varying degrees of safety. Naturally you should always strive to have safer Java. First of all, remember that Java has more built-in safeguards than almost any other language. A Java program is not going to work today and crash your system tomorrow. Further, as long as users dont change their Java environments, the programs that run today should still run tomorrow. Java will change. Methods that work today may not be present in future releases. Worse yet, they may be changed in future releases. Early adopters have already been through several gut-wrenching transitions worst of all the transition from alpha to beta and they survived. Time simply needs to be allotted for code to be rewritten. There are many ways to guard against these problems. Javas robust exception-handling mechanism provides an easy means to deal with classes or methods that unexpectedly disappear between versions of Java. Code from the sun classes can be copied into your own package or placed on your server so that its guaranteed to be available to an applet. Native methods can be backed up by Java-only alternatives that are invoked if the native methods cant be found. Versions can be checked to make sure an application is running in a known environment. However, thats all in the future. Today, the programs that you write with the Sun classes and native code are safe. You should of course try to use garden-variety, safe Java whenever possible, but dont not write the next killer application simply because it requires you to use a native method or to instantiate a sun class. How secret is this, anyway?Some people have questioned whether the title Java SECRETS is truly appropriate for this book. Certainly a lot of the material here is less secret than the internals of Microsoft Windows. Sun licenses the source code very freely (at least the code prior to Java 1.1), and, as youll learn, the byte code is comparatively trivial to disassemble. Source code may be a precise form of documentation, but it is hardly the easiest form to understand. Java source code has been available since the earliest days, but its still left many people confused about exactly how to accomplish their goals. The content of this book may not exactly be secret, but it certainly contains information that is not widely known. Frankly, given the quality of information about these topics that is available, many of them might as well be secret. I expect this book to generate a phenomenal level of interest among Java programmers, most of whom have only a vague idea that this sort of programming is possible in Java, much less the knowledge to do it. SummaryIn this chapter, you learn about the following:
|
![]() |
|