A tale of two languages: Dynamic HTML vs. Java
– Ash on Feb 11 1998
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!
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
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.
var nc = components
myChannel.url = “http://www.mycompany.com/mychannel/home.html”;
myChannel.name = “My Channel”;
myChannel.desc = “This channel is all about parachutes.” ;
myChannel.intervalTime = 60 ;
myChannel.maxCacheSize = 2048000;
myChannel.depth = 2;
myChannel.mode = “window”;
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.
<CHANNEL HREF=” http://www.mycompany.com/mychannel/home.html” PRECACHE=”yes” LEVEL=”2“>
<TITLE> My Channel </TITLE>
<ABSTRACT> This channel is all about parachutes.</ABSTRACT> <SCHEDULE>
<INTERVALTIME HOUR=”1” />
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.
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.
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.
// Describe the channel:
// Set the schedule for push delivery:
// Establish guidelines for the cache size:
// Set look and feel of the channel:
// Go ahead and add channel:
6. What’s wrong with the above code? Runs fine on Communicator with Netcaster.
7. The CDF (based on XML) Solution
<?XML VERSION=”1.0″ ENCODING=”UTF-8″?>
8. How is this better that the previous one.
9. Are Programming languages dead