A Touch of Class
By Al Williams
If you want to start a "tastes great, less filling" argument in a room of Web developers, just bring up Java applets versus ActiveX controls. While most will agree that Java applets are more universally applicable and usually more secure than ActiveX controls, you also have to admit that ActiveX controls provide some interesting features, too -- raw power, control, and binary object-orientation.
The ActiveX standard lets programmers use virtually any language to create objects. Other programmers -- possibly using other languages -- can use your objects, extend your objects, or even create objects that are polymorphic with your objects. (Polymorphism is the ability to treat a specific object as though it were a more generic object.) This is true even if you don't supply the source code with your object. A neat trick, to be sure.
To create Java objects, you'd normally expect to use the Java language. After all, the language is what lets users on different platforms run your applets and other programs. However, Java does let other programmers use, reuse, and create polymorphic objects without having to access the original Java source.
If you think about it, you see an example of this very frequently. When you browse a Web page that contains an applet, your browser creates an instance of the applet. Naturally, the browser doesn't have any idea what the class does or how it works. The class must derive from Applet, of course, but beyond that what it does is its own business.
Class Objects
Java has built-in support for dynamically loading class files.