Pros and Cons of ActiveX and DHTML Controls

Introduction

This document shows a Comparison study of web pages using simple ASP and Pages using ActiveX Controls. By the End of this document, we arrive at a conclusion of using the better Technology.

What is an ActiveX?

If you use a Computer, Microsoft's ActiveX is probably part of your life. The ActiveX technologies have become an essential part of Microsoft applications and tools; they are finding their way into Microsoft operating systems.

All ActiveX Technologies are built using Microsoft's Component Object Model (COM).But the obvious next step-defining ActiveX to encompass all COM based technologies-is wrong.

But didn't ActiveX grow out of Object Linking and Embedding (OLE)? In fact, wasn't ActiveX just a new name for what once called OLE? The answer to both the questions is "Well, sort of"

So what is Active X? Active X is a downloadable program that allow user to do many things. Since the time the internet came on-line, many users complained that the web pages are too static and very passive in the way of interactivity. Active X consisits of active controls and active documents bringing together the technology that allows programs work together.

The initial need of Active X derived from the demand of the Web designers who wanted more interactive web pages. Simple text hyper links and graphics were not enough, and hence the programming language JAVA was created. Through the development of this and the early plug-ins (programs that run code along side the web browser but not in it,) web pages became far more interactive with audio and moving images. Microsoft's response for the plug-ins and JAVA was Active X, a slimmed down net workable version of OLE. OLE is where one application can talk to another program under a Windows environment.

Some Features and Attributes of Active X technology is as follows : 

  1. Active X scripting is used in Microsoft internet Explorer to provide language-independent script handling capabilities
  2. Active X documents supported by Active X means you can use the browser to view any Microsoft software application with that applications native toolbar, menu and other interface elements. This is also advantageous because you can use existing documents on the Internet without having to save them to HTML format.
  3. Active X controls are the features that made this research interesting. These are actual software components embedded in web pages that run in the browser. If you visit a web page that uses, Microsoft's Internet Explorer will automatically check to see if you have the needed control installed, if you do not, it installs it using their Authenticode.

ActiveX Controls: The Building Blocks of ActiveX

The fundamental element of ActiveX technology is the ActiveX control, formerly called an OLE control. An ActiveX control is a modular piece of software that performs tasks and computes information, communicates to other programs, modules, and the Internet by using OLE, and can be easily used and reused by any program or programming environment that can "contain" ActiveX controls, such as Web browsers like Internet Explorer 3.0, or programming environments like Visual Basic, Visual C++ 4.0, or FoxPro. Controls have computational power, communications power, and their own small graphical interface (though its GUI can be disabled for truly custom applications); they can be used like Java applets within Web pages or as any other control in a program created with an ActiveX-compatible programming language. It is for this reason that the term "control" should mean something to Windows programmers, but it might not mean much to an Internet or business application user who has no need to write programs that use controls.

Since ActiveX controls can be as different from each other as the different programs on the shelf at software store, it is somewhat difficult to say what all ActiveX controls share, can do, or have the potential. In addition, since new ones are being written all the time, it is hard to predict what the majority of new ones will do. However, it is exactly this unknown application of ActiveX that makes the technology so exciting; it truly is an open technology! Despite the inability to predict where ActiveX will take you, it is certainly worthwhile to at least consider the capabilities provided by ActiveX controls: 

  1. Compute and manipulate data 
  2. Communicate 
  3. Save programming effort

Features to increase an Active X control's efficiency and effectiveness in certain applications

  1. Just-in-time activation. An ActiveX control can be visible, but not activated. Activation is deferred until the user interacts with the control. The control does not create its window until it is activated, so this option saves time and resources if the control is never activated. 
  2. Mouse interaction while inactive. When a control is visible, but not activated, it can still process mouse messages delegated to it by the container. Once the control is activated, it processes messages in the usual manner. 
  3. Flicker-free activation. If an ActiveX control draws itself the same way in both its active and inactive states, flicker-free activation can reduce screen flicker. This option prevents the control from being redrawn when it makes the transition from the inactive to the active state. 
  4. Windowless activation. A windowless ActiveX control does not have its own window. The container is responsible for routing user-input messages to the control. Windowless controls load faster, do not have to be rectangular, and can have transparent backgrounds. 
  5. Unclipped device context. An ActiveX control can speed up its drawing operations by using this option, if it never draws outside its client rectangle. This option has no effect on windowless controls. 
  6. Optimized drawing. When a container draws several controls into the same device context, each control selects its required graphics device interface (GDI) objects. If each control does not have to restore the previously selected objects, it can save time. The container can restore the original objects after all the controls have been drawn.

Limitations of Active X Controls

All the topics above we were talking about the Advantages and what is Active X, here are the limitations of using the Active X controls. They are as follows:

  1. Active X not currently supported in Netscape, and On UNIX platform. Netscape has a big market browser market and many computers connected to the Internet are UNIX based machines. Failure to support Active X in Netscape and on UNIX might hamper market acceptance.
  2. A big problem exists for Active X, which is the safety of downloadable programs. There is no mechanism for limiting privileges of Active X controls other than as provided by operating system such as Windows NT or UNIX. There is a proposed security model. It would involve the use of cryptographic techniques, which is a digital signature that identifies who is downloading material. The technology, itself, does not safeguard the user from viruses or bad code. All it will do is ensure, after it is placed on the web, that a utility program for a certain task and the controls are tamper- free. 
  3. Active X is not compatible with Non- windows platform

Developing Web pages using Simple DHTML

Fundamentally, DHTML behaviors represent the marriage of cascading style sheet (CSS) formatting and HTML Components functionality. You can assign DHTML behaviors to any element found on an HTML page, offering incredible flexibility in content presentation.

DHTML behaviors are the result of evolutionary process of web design under internet explorer. Previously, if you wanted to add functionality to IE, you had to use ActiveX Controls, which raised a number of troubling security and architectural issues. Microsoft developed the HTML components standard (still waiting World Wide Web Consortium adoption) as an XML replacement for ActiveX Controls.

Think of HTML components as encapsulated DHTML - you can implement them as reusable, self contained files.HTML components are usually coded using VBScript or Jscript.

The importance of HTML Components

The obvious advantage of using HTML Components is that your code becomes clean and modular. As with JavaScript source files (.js), you can access and reuse your HTML Components code across multiple Web pages. Under HTML Components, you can alter a component by modifying a single file rather than making in-line changes throughout your Web site. Components encourage the separation of content from functionality.
DHTML behaviors provide numerous advanced programming tools, including extended browser methods, properties, and scripting access across domains. Functionality can be attached and detached dynamically from HTML elements using script.

Limitations of HTML Components

The limitations of Using HTML components are as follows:

  1. 1. The obvious limitation of this technology is the fact that it is still proprietary, despite Microsoft's attempts to make it a standardized format. HTML Components are supported in IE 5.0 and above.
  2. Netscape does not support DHTML behaviors. Most browsers will ignore the CSS behavior attributes, but references to behavior events, methods, or properties will definitely cause scripting errors in non-IE software.
  3. To successfully deploy DHTML behaviors on a Web site, a browser detection routine is required to ensure the user is running a compliant version of IE before launching the components. DHTML behaviors are thus best suited for heterogeneous computing environments such as intranets.
  4. HTML Components rely on the Windows Scripting Host (WSH) because they are coded using JScript and VBScript. If the user has disabled WSH for security reasons, the components will not function. Moreover, HTML Components are subject to all security limitations internally imposed by IE.
  5. DHTML behaviors will not work if your Web server does not parse all HTML elements on a Web page. You should use readyState variables such as oncontentready and ondocumentready to check for the availability of the component before trying to launch a behavior. Otherwise, your users may receive ugly scripting errors.

Conclusion

Comparing both ActiveX Controls and HTML components we may conclude that when we have Complex Business logic and frequent usability of the business logic ,it is always better to go for ActiveX control as Code reusability is there and in turn reduces effort involved in developing the business logic. Otherwise, it is always better to go for Normal HTML components, as there is not much security issues compared to ActiveX Controls. However, OS handle Security issues properly and it is always better to keep up with technology development so finally we conclude by stating that ActiveX are far better than simple asp.