by Michael Morrison
It's pretty much impossible to discuss ActiveX without bringing up its relationship to Java. Although you've already learned about some of the differences between ActiveX and Java, it's time to take a closer look at exactly where each technology is
positioned in the whole of the interactive Web. With all the hype associated with both Java and ActiveX, it's easy to get confused over where each is headed. Even more important to Web developers is the issue of deciding which technology to embrace and
whether that decision can even be made.
The goal of this chapter is to give you some perspective on the relationship between Java and ActiveX. In doing so, you learn the details surrounding what each technology offers and why they don't necessarily have to be viewed as direct competitors. In
fact, you learn that the stage is being set for the two technologies to complement each other in a variety of ways.
In a general sense, Java and ActiveX are both trying to achieve the same goal: to bring interactivity to the Web. This is a very general goal, and, as you probably realize, many different approaches can
be taken to reach it. Java and ActiveX definitely take different routes to delivering interactivity to the Web, and for good reason; they're widely divergent technologies that come from two unique companies. First, take a look at each technology and see
what it accomplishes in its pursuit to liven up the Web.
First and foremost, Java is a programming language. It certainly is other things as well, but the underlying strength of the Java technology is the structure and design of
the Java language itself. The architects at Sun wanted to take many of the powerful features in C++ and build a tighter, easier to use, and more secure object-oriented language. They succeeded in a big way; Java is indeed a very clean, easy-to-use language
with lots of advanced security features. The time spent designing the Java language is paying off well for Sun, since the language's structure is the primary cause of the C++ programmer migration to Java.
However, without its standard class libraries and Internet support, the Java language would be nothing more than competition for C++. In fact, the Java language, as cleverly designed as it is, would probably fail in a head-to-head match with C++,
strictly from a language perspective. This is because C++ is firmly established in the professional development community, and programmers need a compelling reason to learn an entirely new language. Fortunately for Sun, Java has been presented as much more
than just another programming language.
The basic Java technology consists of the Java language, the Java class libraries, the Java runtime system, and the JavaScript scripting language. It's the combination of all these parts that makes the Java technology so exciting. Java is the first
large-scale effort at creating a truly cross-platform programming language with lots of functionality from the start. Couple the slick language and cross-platform aspects of Java with the ability to seamlessly integrate Java programs into the Web
environment, and you can easily see the appeal.
This integration of the Web into the Java technology is no accident; Sun simply saw the potential to capitalize on a technology they had been developing for a while by fitting it to the Internet's rapidly growing needs. This pretty much sums up the aim
of Java: to give you a means to safely integrate cross-platform interactive applications into the Web environment by using an object-oriented language.
Microsoft has different ideas for the Internet than Sun does. Unlike Sun, Microsoft initially didn't realize the immediate potential of the Internet, or at least they
didn't see how fast it was all happening. In fact, it wasn't until the excitement surrounding Java that Microsoft finally decided they had to rethink the Internet and the Web.
The connection was finally made somewhere in Redmond that the Internet would significantly affect personal computing. They couldn't just sit idly by and see what happened; they could either take action to capitalize on the Internet or get
"burned" by not accepting it as a major shift in the way computers are used. When Microsoft finally came to terms with the Internet rapidly changing the face of computingeven personal computingthey quickly regrouped and decided to
figure out a way to get a piece of the Internet action. Keep in mind that Microsoft has never been content with just a piece of the action; they want the largest piece of the action!
Unlike Sun, Microsoft already had a wide range of successful commercial software technologies; they just had to figure out which one would adapt best to the Internet. It turned out that one of their most successful technologies was ideally suited for
the Internet: OLE. They saw OLE as a powerful, stable technology with lots of potential for the Internet, and they were right; ActiveX is basically OLE revamped for the Internet.
Unlike Java, however, ActiveX isn't just meant to be a way to add interactivity to the Web. Sure, that's part of it, but Microsoft isn't the type of company to just hand
out technologies for the good of humanity. OLE is a technology deeply ingrained in most of Microsoft's commercial products, as well as many other commercial Windows applications. By simply migrating OLE to the Internet (ActiveX), Microsoft can effectively
assume a huge market share of Internet products overnight. Suddenly, every piece of code based on OLE can now be considered ActiveX-enabled with little extra work. Microsoft's new goal of migrating desktop software to the Internet suddenly looks quite attainable!
Although Microsoft is certainly looking to bring interactive applications to the Web through ActiveX, they are making sure that many of those interactive applications are
Microsoft applications. This situation also ensures that Windows remains a strong presence on the Internet, since OLE is essentially a Windows-derived technology. Although strategically ideal, selecting OLE as the technological underpinnings for ActiveX
has much more to do with OLE being a slick technology already tweaked for distributed computing; it's just the icing on the cake that OLE is already firmly established in the PC development community.
Microsoft isn't the only company to benefit from the positioning of ActiveX. Every PC software developer that uses OLE in its applications will benefit from ActiveX just as easily as Microsoft will. Because the PC development community is by far the
largest in the industry, end users will also benefit greatly, since many software companies will be building ActiveX applications from existing OLE code that's already stable.
So far in this discussion of ActiveX, little has been said about programming languages. Unlike Java, ActiveX has nothing to do with a specific programming language; you can write ActiveX code in any
language you choose that supports Microsoft's COM specification. Just in case you don't realize it, this is a big deal! Although Java is a very powerful language, many programmers don't like being forced to learn a new language just to exploit the
capabilities of the Internet. On the other hand, writing ActiveX controls in C++ is a little messier than writing Java applets in Java.
In many ways, the ActiveX technology extends beyond the reach of Java. For example, as you've already learned, ActiveX offers Microsoft's answer to CGI scripting with ISAPI applications and filters. Additionally, the whole concept of ActiveX documents
is far beyond anything Java has to offer.
At this point in the discussion, what's important is that although Java and ActiveX both serve the same ends of bringing interactive applications to the Web, they do so for different reasons and use two distinct approaches. Ultimately, ActiveX is a
more complete technology, even if it's more complex to learn and use at the programming level.
OK, so you have an idea what each technology is trying to accomplish, but what does each actually deliver? It turns out that Java and ActiveX are surprisingly different in their implementations,
especially considering how similar their ultimate goals are.
The Java technology can be broken down into these four major components
The Java language supplies the programmatic underpinnings that make the whole Java system possible. It's the Java language that shines brightest when comparing Java to ActiveX. The Java class libraries, which go hand-in-hand with the language, offer a
wide array of features guaranteed to work on any platform. This is a huge advantage Java has over almost every other programming language in existence. Never before has a tight, powerful language been delivered that offers a rich set of standard classes in
a cross-platform manner.
The Java runtime system is the component of Java that gets the least press attention, but ultimately makes many of Java's features a reality. The Java runtime system includes a virtual machine, which stands in the middle between Java bytecode programs and the specific processor
inside a computer system. It's the responsibility of the virtual machine to translate platform-independent bytecodes to platform-specific native machine code. In doing so, the virtual machine supplies the mechanism that makes Java platform-independent.
Unfortunately, the virtual machine is also responsible for the performance problems associated with Java. These problems will more than likely disappear, however, when just-in-time Java compilers become prevalent.
The JavaScript scripting language is the component you use to place Java programs directly into HTML code. The primary purpose of JavaScript is to allow Web developers who aren't necessarily
programmers add interactivity to their Web pages in a straightforward manner.
Although you've already learned about each ActiveX component in detail in previous chapters, quickly review the following major components that compose the ActiveX technology:
ActiveX controls are self-contained executable programs that can be embedded within a Web page or a standalone application. Acting as an extension to OLE controls, ActiveX controls can be used to
perform a wide range of functions, both with or without specific support for the Internet. ActiveX controls are essentially Microsoft's answer to Java applets.
ActiveX controls are Microsoft's answer to Java applets; VBScript is Microsoft's answer to JavaScript. Built on the highly successful Visual Basic programming language, VBScript gives you much of the same functionality as JavaScript, but in an
environment already familiar to many PC developers.
ActiveX documents are similar to ActiveX controls, except they're focused on representing and manipulating a particular data format, such as a Word document or an Excel spreadsheet. There's no
logical equivalent in Java to ActiveX documents; ActiveX documents are a piece of the ActiveX technology that's completely foreign to Java.
The final component of ActiveX is the ISAPI scripting language and server support. ISAPI provides a more powerful answer to CGI scripting, which has long been used to supply pseudo-interactivity for
Web pages. ISAPI goes a step further by giving you a means to build filters into Web servers. Again, Java offers nothing comparable to this aspect of ActiveX.
You might be beginning to understand how ActiveX is aimed at being a more complete Internet technology than Java. Java certainly has its strengths, but it's somewhat limited as a complete Web solution. ActiveX, on the other hand, tries to provide an answer for every major aspect of Web development.
By now, you not only understand what Java and ActiveX are trying to accomplish, but you have a good idea of how each are delivering on their promises. I've mentioned some of the differences between
each technology while describing its relevant aspects, but it's time to dig in and take a look at what these differences really mean.
Although ActiveX, as a technology, delivers more than Java as far as individual components, the primary interest for most developers is how ActiveX and Java stack up from the standpoint of adding interactivity to Web pages. This interest forces you to
analyze the differences between ActiveX controls and Java applets, since they are the primary aspects of each technology that deliver Web page interactivity.
Probably the most significant divisive issue between ActiveX and Java is security. No one argues the fact that security is an enormous issue when it comes to the Internet.
Both Sun and Microsoft saw the importance of security and took appropriate actions in designing their respective technologies. However, they each took a different approach, resulting in drastically different usage issues. Consider Sun's approach: Java's
security consists primarily of verifying the bytecodes as a program is being interpreted on the client end, as well as not allowing applets access to a client user's hard
drive. The first solution of verifying bytecodes, although imposing somewhat of a performance hit, is reasonable. However, the limitation of not being able to access the hard drive is pretty harsh. No doubt, Sun took the safest routeit's very
unlikely anyone can corrupt a user's hard drive using Java, considering he or she isn't allowed access to it. Because of this limitation, it's also equally unlikely that developers could write Java applets that perform any significant function beyond working with data on a server.
Now consider Microsoft's security approach with ActiveX: ActiveX uses a digital signature attached to each control, which specifies the control's original author. The
signature is designed so that any tampering with an executable after its release will invalidate the signature. What this means is that you have the ability to know who the original author of a control is and, therefore, limit controls' use to only those
written by established software vendors. If someone hacks into a control developed by an established vendor, the signature will protect you. Granted, this approach pushes some responsibility back onto the user, but it's a practical reality that freedom
never comes without a certain degree of added responsibility.
When it comes to security, I think Microsoft has capitalized on what a lot of people are starting to perceive as a major flaw in Java. For the record, Microsoft implemented the signature approach in ActiveX after the release of Java, meaning that they
had the advantage of seeing how Sun tackled the security issue and could then improve on it. There's nothing wrong with thisit's just an example of how every technology, no matter how powerful and popular, is always susceptible to another one coming along and taking things a step further.
When I initially heard about the security limitations of Java, it all sounded plausible. Why not just go the distance and be completely safe about everything? For the
purposes of livening up the Web, writing to a user's hard drive just didn't seem like that big of a deal. However, ActiveX has ushered in a new way of thinking about the whole issue of adding interactivity to the Web; it's not just about showing neat
animations and creating more exciting marketing promotions. ActiveX is attempting to take interactivity to a whole new level, simply by moving desktop software to the Internet.
This is another critical difference between ActiveX and Java: the ability to build practical applications for the Internet. Currently, although some exciting things are being done in Java, little has surfaced in the way of
full-blown practical applications or applets. To be fair, applications take a while to develop and Java is certainly new enough that many developers are just getting used to the idea. Nevertheless, the fact that nothing of significant practicality has been
built using Java should at least make you take notice. ActiveX, on the other hand, is practically bursting with practicality. Most major Windows productivity software is based on OLE, which is the backbone for ActiveX. Therefore, ActiveX immediately
inherits a wide assortment of very practical applications and controls.
The issue of practicality isn't all that important when you just think in terms of making Web pages a little more exciting. However, when you shift your mode of thinking about the Internet to encompass software in general,
you start to understand why it's so important. Microsoft has benefited greatly by being a late participant in the Internet game. Without being caught up in the immediacy of making Web pages more interesting, Microsoft could rethink the big picture of how
the Internet and the Web affects software as a whole. Consequently, ActiveX addresses software migration to the Internet from a much wider perspective. Microsoft's goal with ActiveX is no less than moving desktop software to the Internet. It's a pretty
ambitious goal, but ActiveX has the substance to put them on track to achieve it.
In all the recent excitement surrounding programming and the Web, which has basically revolved around Java, I've been concerned about what it will all mean to
software developers. Being a Windows programmer myself, I've always been frustrated that writing networked applications has been so much more difficult than writing desktop applications. The difference has been so drastic that you practically have to
specialize in one type of programming or the other.
When Java came along, I suddenly saw a language as powerful and useful as C++, but with enough interesting networking support built-in that I could write both types of applications without developing an ulcer. I think this accounts for much of the
excitement among developers quickly jumping on the Java bandwagon. And rightly so! Software developers deserve a break from the headaches of network programming, and Java delivers in this area quite nicely. However, when you approach Java from the
perspective of someone who has been developing commercial software, you can't help but feel like there's something missing. The lack of decent development tools is rapidly changing, so that's not a long-term problem. Ultimately, the inability to see a use
for Java beyond flashy applets is causing many developers to at least reconsider what Java has to offer.
ActiveX, on the other hand, offers a solution to the problem of merging two different programming disciplines and provides a powerful and practical framework to build real applications for the Web. Microsoft realized the problem of having to take two
different approaches to writing networked applications and non-networked applications, and they are addressing it directly with ActiveX. With ActiveX, you can write controls and applications just as you did before, then gain the benefits of Internet
support by adding a minimal amount of extra code.
Even though I've been leaning toward ActiveX in comparing the two technologies so far, please understand that I don't see Java and ActiveX as existing in an either/or situation. The software development community is far too diverse to try to say that
one technology surpasses another in every possible way. In addition, you have to consider that both of these technologies are in a constant state of flux, with new announcements and releases popping up weekly.
In my opinion, it's foolish to think that a single software technology will take the Internet by storm and eliminate all others. Java will naturally find its way to where it's best suited, as will ActiveX. Likewise, smart software developers will keep
up with both technologies and learn to apply each when the benefits of one outweighs the other. My goal is just to try to shed some light on where the differences between the two technologies lie and hopefully give you some insight into determining what
each has to offer you.
Just in case you're getting nervous about having to learn two completely new types of programming, here's some reassuring news:
Microsoft has released a technology allowing developers to integrate Java applets with ActiveX controls. What does that mean? Well, since ActiveX is language-independent, it means you can write ActiveX controls in Java. Furthermore, it means you can access
ActiveX controls from Java applets and vice-versa. To me, this is a very exciting prospect: the ability to mix two extremely powerful yet seemingly divergent technologies as you see fit.
The technology I'm talking about is an ActiveX control that acts as a Java virtual machine. What is a Java virtual machine? A Java virtual machine is basically a
Java interpreter, which means it's ultimately responsible for how Java programs are executed. By implementing a Java virtual machine in an ActiveX control, Microsoft has effectively integrated Java into the ActiveX environment. This integration goes well
beyond just being able to execute Java applets as though they were ActiveX controls; it provides a means for both ActiveX controls and Java applets to interact with each other.
Microsoft's willingness to embrace Java as a means of developing ActiveX objects should give you a clue about the uniqueness of each technology. It could well end up that Java emerges as the dominant programming language for the Internet, while ActiveX
emerges as the distributed interactive application standard. I know this seems like a confusing situation, but it does capitalize on the strengths of both Java and ActiveX.
The main point I'm trying to make is that ActiveX and Java are both strong in different ways, which puts them on a collision course of sorts. The software development community is pretty objective; if programmers can have the best of both worlds by
integrating ActiveX and Java, then why not do it? No doubt both Sun and Microsoft will have a lot to say about this prospect in the near future. The ActiveX Java virtual machine is a major step in the right direction. My plan is to just sit back and enjoy
the show!
This chapter focuses on ActiveX as it relates to Java. ActiveX tackles so many of the same issues as Java that it's important to understand the similarities and differences between the two technologies. You have learned how ActiveX and Java overlap,
along with a surprising amount of differences between them. Keep in mind that ActiveX and Java don't necessarily need to be considered rivals, simply because each shines in different situations. This point is hammered home when you realize there are future
plans for a mixing of ActiveX and Java. It's an exciting and often unnerving situation for Web developers, but these two technologies are laying the groundwork for a whole new generation of software.
If you think the idea of mixing ActiveX and Java is exciting, wait until you find out how ActiveX is being used to bring the Internet to the Windows desktop. The next chapter, "ActiveX Goes to Nashville," tackles this very topic by exploring how ActiveX is integrating the Internet with the new Windows shell, code-named Nashville.