Nancy Winnick Cluts
Developer Technology Engineer
Microsoft Corporation
Posted February 13, 1998
Contents
Introduction
Pros and Cons
ActiveX Controls
Java Applets
Dynamic HTML
Any Other Considerations
What Now?
Introduction
I love innovation. I especially like having choices about how to implement something on my Web pages.
Where once I had only HTML, now I have:
- Dynamic HTML (DHTML)
- scripting (in lots of different languages, on the client and on the server)
- applets
- ActiveX controls
- DHTML scriptlets
I can do far more with Web pages than ever before. So why am I uneasy? Because there's a downside to this wealth of technologies: utter confusion about when to use what. When is a control called for? Why would I ever want to use a DHTML scriptlet? How about an applet?
DHTML permits interactivity on otherwise static HTML pages. With DHTML, you can manipulate any page element, change element styles and colors, and position elements on the fly (not just when the page is loaded). DHTML includes a document object model to allow programmability, the ability to manipulate data on the client (known as "data binding"), and support for scriptlets, which are reusable bits of HTML and script that can be used for presenting interactive content.
Applets let you do some tasks that you can't do with HTML. A popular early use of applets was to provide user-interface components (i.e., buttons, boxes, and so forth) on the Web page. In the beginning, Java applets were just about the only game in town for this functionality. Now, you can do such tasks with ActiveX controls as well, or with Dynamic HTML -- probably the easiest and most lightweight method. Applets also provide limited cross-platform and cross-browser compatibility. Unfortunately, their limitations make it difficult to write an applet once, and have it run everywhere. Since the level of compatibility varies, you have to test it everywhere. What you save in development cost might cost you dearly in testing and debugging.
ActiveX controls are great for accessing system services, threading, providing user interface components, or accessing the registry. Controls can also be speedy, once on the client, because you can use powerful development languages, such as C or C++, to create them. The biggest downside to ActiveX controls is the lack of browser support from all browsers.
Back to top
Pros and Cons
Each technology has its strengths as well as its weaknesses. That's just the nature of technology -- there's no such thing as the perfect language, platform, or browser (and adding functionality and features is what keeps us developers employed!). Web developers should use the right tool for the job, based on what they are trying to accomplish. Some things to keep in mind when deciding what to use (and in what combination) are:
- Functionality
- Ease of implementation and tool availability
- Reusability
- Cross-platform issues
- Performance
Back to top
ActiveX Controls
An ActiveX control is an OLE control (.OCX) that supports additional ActiveX features designed to make it easier to distribute components over the Web and to integrate controls into Web browsers.
ActiveX supports code signing (security authentication) so that the user can verify the author of the control before allowing the control to download. ActiveX controls let a developer take advantage of the functionality of languages, such as C, C++, and Visual Basic®, more powerful than basic scripting and HTML. With ActiveX, you can easily access system services, the registry, and printing. The ActiveX Control Tutorial provides an excellent introduction for those wanting a walk through ActiveX-control technology.
ActiveX control pros
ActiveX controls provide excellent integration with Win32 tools and applications. Visual InterDev provides the tools you need to create dynamic Web applications. (The price is right, too -- free for a 30-day trial).
A key advantage over Java applets and Netscape plug-ins: ActiveX controls can also be used in applications written in many programming languages, including all the Microsoft programming and database languages. If you are lucky enough to work with a staff blessed with a mixture of software-language experience, you might just pick up Visual Studio . It contains Visual Basic 5, Visual C++® 5, Visual J++, Visual FoxPro, and Visual InterDev -- kind of the developer's answer to the kitchen sink. Visual Basic Control Creation Edition provides the tools and information to create controls easily and rapidly in Visual Basic -- you don't need to hire a bunch of C++ gearheads to write them. But if you are like me (a C++ gearhead), you can use C++ alone or use Microsoft Foundation Classes (MFC) or the Active Template Library (ATL) to write an ActiveX control. Several articles are available on the Web to help walk you through the process. Just jump over to the ActiveX controls section of MSDN Online Web Workshop for details.
You don't even have to write ActiveX controls to take advantage of them. You can always buy some. There are literally hundreds of ActiveX controls available today, with functionality ranging from a timer control (which simply notifies its container at a particular time) to full-featured spreadsheets and word processors. Check out www.activex.com for a sampling.
ActiveX controls are easy to add to your pages. Simply use the standard HTML <OBJECT> tag. It includes a set of parameters that you use to specify which data the control should use and to control the appearance and behavior of the control. One note : You do need to know the class identifier (CLSID) to add an ActiveX control to a Web page (you don't need to use the CLSID if you use a DHTML scriptlet). A CLSID is a globally unique identifier that the operating system uses in order to determine which control (or COM object) to use. More detailed information about CLSIDs can be found in the Internet Client SDK.
|
|
ActiveX control cons
The biggest drawback: ActiveX controls are supported fully only in Macintosh and Win32-based environments. They are not fully supported under Windows 3.1 or UNIX. If your audience is likely to be running Windows NT or Windows 95, then this isn't an issue.
ActiveX controls are not "sandboxed." Java applets run in a protected area, known as the sandbox, where you cannot access the client machine (i.e., you can't write to the hard drive, you can't delete something, and so forth). Before ActiveX controls are downloaded onto the machine, they first require the end user to decide whether to trust the author of the control. This gives the user the power to decide whom to trust, and whether to run an application, but does require users to understand the issues involved with downloading any piece of code (including signed Java applets).
|
|
Back to top
Java Applets
Java applets are written in the Java language, so they provide more language functionality than HTML and script. Reviewers have consistently found that Internet Explorer 4.0 provides the fastest, most functional, and most compatible environment for running Java applets. Even so, many sites have stopped using applets due to Java's poor performance on Windows 3.1 and older Macintosh machines, as well as incompatibilities across the many different implementations of Java.
With extensive testing and debugging, it may be possible to develop an applet that runs across multiple browsers and platforms. However, it is difficult to port significant functionality across multiple platforms. In addition, the performance problem on Windows 3.1 and older Macintosh systems makes Java impractical on those platforms.
Java applet pros
Java really is a cool language. As a developer, I see it as essentially C++ done right.
Java is pretty easy to learn if you are already a C++ or C programmer. This is a really big win (it's so hard to keep developers happy, and there is only so much money in the budget for T-shirts).
With the Application Foundation Classes (AFC), you can create enhanced user interfaces for multiple platforms.With J/Direct, you can use Java to write applications that take advantage of key Windows functionality (and there are lots of Windows desktops out there).
Internet Explorer 4.0 provides excellent support for Java , so if you are writing a Java applet, you know that your applet will run on Internet Explorer 4.0. |
|
Java applet cons
Although you can, theoretically, write a cross-platform Java applet you will be severely limited in what you can do on Windows 3.1 and low-end Macintoshes. Currently, almost 25 percent of all machines connected to the Internet use one of those platforms, so your Java applet may not be available to everyone. Test everywhere!
Java applets aren't necessarily small or fast. You can write a small, fast applet, but the more functionality you try to put in it, the bigger it gets. Yes, software bloat can even happen to an applet. Also, to use the applet on the client machine, the user must first download the applet. It takes a long time to download a 500K piece of code at 28.8 Kbps.
Java has a steeper learning curve than HTML or script. If your programmers already know C, then they can use ActiveX instead of having to learn a new language.
It has been promised that the Java Development Kit (JDK) will eventually allow you to compile applets directly to native code. Until that happens, anyone with programming savvy can steal your sources. And if they can read your sources, you may also have a security issue.
Java applets are currently used on less than one percent of all Web pages.
|
|
>Back to top
Dynamic HTML
Dynamic HTML allows you to manipulate the Web page after it has loaded. DHTML is a set of technologies consisting of:
- The Dynamic HTML Document Object Model, which allows you to access all page elements and attributes, and provides automatic reflow of the Web page. Microsoft's implementation of the Document Object Model is based on a proposal to the World Wide Web Consortium (W3C) from August 1996, and is consistent with the current working draft. Late last year, the W3C released the HTML Document Object Model Working Draft for public review.
It supports the manipulation of all elements and attributes on a Web page as programmable objects and properties, taking advantage of the current standards: HTML 4.0, CSS, CSS-Positioning, and ECMAScript. You can find them in the MSDN Online Web Workshop DHTML area.
- Data binding, which allows the data caching and manipulation on the client machine.
- DHTML scriptlets, providing the ability to write reusable, fast, lightweight UI components using HTML 4.0 and ECMAScript.
DHTML pros
DHTML lets you create a great interactive user-interface. You can change the attributes of any element on the page, on the fly, and your user won't see the whole page being redrawn.
Since DHTML is based on HTML, you can leverage your current HTML coding experience. You don't have to learn a new language to take advantage of its functionality.
Key DHTML features are included in Internet Explorer 4.0 for the Windows 95, Windows NT, Windows 3.1, Macintosh, and UNIX operating systems. You wanted cross-platform?
DHTML is an open, standards-based technology. The Document Object Model (DOM) supported by DHTML is based on a proposal to the W3C). DHMTL is consistent with the DOM Level 1 Working Draft, and Microsoft is committed to supporting the DOM recommendation (here again, the W3C decides). HTML 4.0, CSS1, the working draft for CSS positioning, and ECMAScript are all standards supported in Internet Explorer 4.0, and thus DHTML. The Data Source Object architecture of DHTML is open, and supports ActiveX controls as well as applets.
DHTML is fast and small. It doesn't have the overhead ActiveX controls or Java applets require, because it is supported directly in the browser without the need for additional Dynamic Link Libraries (.dll files) or classes. So, if your goal is to provide great user-interface elements, DHTML is a great answer. DHTML scriptlets, in particular, are ideal for fast, lightweight, reusable user-interface components (such as a stock ticker).
Though relatively new, DHTML has some pretty extensive tool support. A whole raft of tools, from FrontPage 98 to third-party tools, can be found in the DHTML area of Web Workshop. |
|
DHTML cons
Microsoft and Netscape have different implementations of DHMTL. The biggest difference? Netscape's implementation does not expose all elements as objects and all attributes as properties, which Microsoft's does. Netscape does not fully support HTML 4.0 or ECMAScript (which provides language enhancements to the JavaScript 1.1 language).
|
|
Dynamic HTML is not an object-oriented programming language. For some people, this is a "con." But whether a language is object-oriented should not be the gating factor for using a language. If all things are equal, why not try it, and see if it fits your needs?
Back to top
Any Other Considerations?
Now I've shown you some of the pros, cons, and "ehs" for the different technologies. What's a Web Developer to do? There are a few more considerations to bear in mind:
Language Skills
If you already have a team of developers who are skilled on one language, do you have the bandwidth and time to learn a new language? With the exception of Dynamic HTML (which is based on HTML), you may have to cajole a developer into learning Java, or C++, or Visual Basic.
Cross-Platform
How can you create the best possible Web page that will run on different platforms? Tailor your Web sites for each platform you support. You do this by checking the browser and operating system running on the user's machine, and provide page elements based on those factors. This sounds like a lot of work -- and it is. The downside is more code, more testing, and maintenance. The upside is the ability to provide compelling Web pages that are tweaked to run great on the user's machine. I've yet to meet a user who really cares whether something I wrote runs on someone else's machine. He generally just wants it speedy and cool on his machine. Even if you aren't tweaking for different systems, you still have to test on every single platform and browser, because all Java VMs are not alike (not even on UNIX; the VM is different for the different flavors of UNIX).
Back to top
What Now?
I've stuck my neck out a lot in this article. I'm sure I'll get hate e-mail as a result. (Please put the phrase "Hate Mail for Nancy" in the subject line). Hopefully, though, you'll read it in the spirit of a simple comparison. If you'd like to get an opinion from another source, The Forrester Report on Interactive Technology Strategies (Volume 2, Number 6, August 1997) goes into detail on the different technologies, as well as the pros and cons associated with each.
Nancy Cluts, developer-technology writer extraordinaire, has faced some big choices in her life, too. Happily for us, she's always made the right ones.
More information
For comprehensive information on Dynamic HTML, visit MSDN Online Web Workshop's DHTML pages. You'll find references, how-to articles, examples, and resources.
Whoa, Dude
Roaring mouseovers? Bubbling events? It can boggle the mind. But Michael Wallent leads you through it each month in his MSDN Online Voices column, The DHTML Dude.