A tale of two languages: Dynamic HTML vs. Java
– Ash on Feb 11 1998

1. Abstract
When Microsoft was releasing IE4, the trade press was abuzz with rumors on how Microsoft would use Dynamic HTML to kill Java on the client. Most analysts thought Microsoft was nuts. After all Java was this great gift from God and how could you dare compare tag based language to a full-fledged programming language. In reality, Dynamic HTML was not competing with Java, in fact you could use Java to program the Dynamic HTML document object model (DOM). Unfortunately, the philosophy and purpose behind HTML was not understood. This article tries to describe the differences between a <TAG> based language and a programming language and why xml based applications will be so powerful.

2. The wannabe universal platforms
Unix and C were the first attempts to unify the diverse computing landscape. They were based on the philosophy that one language, one OS, one API, etc. is better than the multiple platforms that existed. Unfortunately there is a reason why multiple platforms exist, different people use them to do different things. Each vendor optimized Unix to it’s user base and did not want a bland stripped down variety. The last attempt to unify Unix was OSF, which was formed to stop Windows NT failed.

Enter Java, which combines all the three concepts: a Virtual Machine, a set of common APIs and an easier programming language than C++. These were supposed to be the killer universal platform of the 90s. Like Unix and C, Java is trying to solve the wrong problem. Diversity is what makes the computing landscape so powerful. The reason that Mac is a religion is because it is the Mac. Adding a common API to it defeats the purpose.

3. Programming Languages and Copernicus
Copernicus predicted that the Sun not the Earth is at the center of the universe. Not many people believed him at that time, due to age-old beliefs of the Earth being as the center. We are blessed with a legacy where programming languages have been at the center of the universe. Jobs advertisements demand C++, Java skills. HTML coders are lowly paid compared to C++ programmers. Programming languages have such a mystical hold on us that we think we can throw them at any problem and voila, it is solved!

The first high level language FORTRAN was intended as an easy way to execute step by step instructions as compared to assembly code. Since then, programming language have become modular and gained object oriented features. However, they still remain good in executing step by step instructions. The problem is not Java, C++ or JavaScript: they remain excellent languages. But we need to be careful what we use them for.

4. The power of HTML
HTML succeeded as the cross platform display language because it did not tie itself to some cross platform visual GUI API, language or OS. HTML expresses how the document should be displayed, not how to display it. This is a powerful concept, tell people what you want, instead of how to do it. That way, a left-handed person can use his left hand to hammer a nail, instead of following step by step instructions written for a right-handed person

<EM>Hello World</EM>

In the above document, the HTML code tells the browser that it wants Hello World to be emphasized. How it is emphasized is left to the browser. Some systems may draw “Hello World” in Bold or Italics font. An audio device may change the tone of it’s voice or a pager may beep when displaying the text. In any case, you can be assured that every system that has a browser will use the right method to display it. In effect you are telling the browser what you want, instead of how to do it. This allows you to concentrate on more useful things, instead of step by step instructions for different devices. Let’s compare the same application, one built with a programming language and the other which uses XML.

5. The Netcaster (based on JavaScript) solution
Netcaster uses a JavaScript component hosted in the Navigator browser called `netcaster’. This netcaster object exposes the properties and methods to create the channel. This is how a typical object oriented programming language would attempt to solve the problem.

<SCRIPT LANGUAGE=”JavaScript1.2″>
function subscribe()
var nc = components

[‘netcaster’] var myChannel = nc.getChannelObject(); 

// Describe the channel:
myChannel.url =
myChannel.name =
“My Channel”;
myChannel.desc =
“This channel is all about parachutes.” ;

// Set the schedule for push delivery:
myChannel.intervalTime =
60 ;

// Establish guidelines for the cache size:
myChannel.maxCacheSize =
myChannel.depth =

// Set look and feel of the channel:
myChannel.mode =

// Go ahead and add channel:


6. What’s wrong with the above code? Runs fine on Communicator with Netcaster.
First the above code depends on JavaScript 1.2 to be present for it to work. It specifically depends on the netcaster component to be present and all the properties and methods to match the code. There is no error checking or version detection. If Communicator 5’s netcaster component has an additional property like alturl (for alternate URL), this code will have to detect the version of the netcaster component. If other browsers support a different set of properties for the netcaster components, then each line of the above code will be messed up with error and version checking code. If you want to use the above format then, then you need to license JavaScript 1.2 from Netscape and create a netcaster javascript component in your application. This is a bad standard as it was not designed to be platform independent and it is tied to a programming language.

7. The CDF (based on XML) Solution
CDF is an XML file. That means it has a document type definition which defines the structure of the file. On the client side a CDF component parses the file and figures out what to do with it.

http://www.mycompany.com/mychannel/home.html” PRECACHE=”yes” LEVEL=”2“>
My Channel </TITLE>
This channel is all about parachutes.</ABSTRACT> <SCHEDULE>
1” />

8. How is this better that the previous one.
First, It is not tied to any language or platform or technology. It is a structured Text file that tells the CDF component how to handle this channel. This means the client does not require JavaScript 1.2 to run it. It is also extensible and compatible across different CDF clients and CDF file versions. If alturl needs to be added, then a new tag could be added to the CDF file. Earlier versions of the CDF client would simply ignore the tag. If some CDF applications used the <DESC> tag instead of abstract, you could simply add the <DESC> tag along with the <ABSTRACT> tag. Since you are writing a description of the channel rather than the code for it, you don’t have to worry about error conditions and version checking.

9. Are Programming languages dead
Programming languages do the job they were originally designed to do. Execute step by step instructions really well and encapsulate knowledge into components very well. Programming languages will continue to thrive but we do not want to use them for communication anymore. We will still write components with it. After all, if you can tell the computer what you want, why do you still need to tell them how to do it.

10. Conclusion
HTML did not succeed because it was just simple. It succeeded because it allowed you to specify the knowledge, on what the document should look like, not how to display it. Languages like Java, C++, etc. will be used more for writing components. The browser, the CDF bean, smart agents, etc. will be written in Java/C++. But the intelligence has moved on to XML based languages. It was and always is, choose the best tool for the job. And it’s time we let these languages take the some of the spotlight that was reserved for programming languages.

11. Links
Jon Bosak of Sun Microsystems describes the vision for XML and Java in XML, Java and the future of the Web. Amazing isn’t, how you can get a clear picture without the marketing fluff, if you listen to the right people. Also, Netscape hired Tim Bray and R.V. Guha, both XML experts, and it looks like Navigator 5.0 will go the XML route with RDF.

12. References
XML 1.0 standard
HTML 4.0 standard
The Java Platform Reference
Netcaster Technology
CDF Technology