ericsson competence solutions

Publications - Articles

The Advantages and Disadvantages of Using Java in and Internet Training Course

By: Jason Bratton



Abstract

Introduction

It seems nowadays that the words Internet and Java go hand in hand, some developers singing it's praises, others warning of it's pitfalls. This document will take a non-biased look at some of the advantages and disadvantages of using Java for the development of online training.

What does the Internet mean for training?

Since teaching began, emphasis has always been placed on face to face communication. It has been, and continues to be the leading method through which to obtain information throughout the world. This method does, however, pose certain problems of a geographical and economic nature. Take for example a student in Mexico who needs to learn a course on the Capability Maturity Model (CMM). The only expertise available to him may only be as close as Japan. Therefore, a teacher has to be flown, at great expense, to Mexico, or vice versa, in order to teach one person a relatively short course.

Everyday more computers attach to the existing networks and every new computer adds to the user base - at least twenty seven million people are interconnected today. This is the possible target audience. How much easier would it be to provide and maintain one course on a network server than have many teachers throughout the world teach it?

This is where the Internet is beginning to make a huge impact. What if CMM could have been offered to the student on a desktop PC? This would seem to solve both of the problems highlighted. The problem now, however, lies with quality. Can the student be guaranteed to obtain a course that is as understandable and coherent as the face to face teaching method? If all that is going to be offered is a text/graphics based course the answer may, arguably, have to be no. What is definitely required is technology that brings the content alive, makes it more interactive, automatically records information and much more.

Could Java be the answer we are looking for? That is the question posed by this document. Sun Microsystems and many others argue yes!

What is Java?

Java is a new language developed at Sun Microsystems that raises the level of technology on the WWW and allows the development of more interactive Web sites. The technology is based upon

  • true executable content embedded in an extensible language;
  • automatic download of applications ("applets") in a safe manner;
  • portability by standardising on a "neutral" architecture;
  • client/server functionality on the Internet or "intranet;"
  • built-in security that is extensible.

Brief History

The Java story began in 1991 with "Project Oak" and "Project Green" at Sun Microsystems. These projects were concerned with building an appropriate control system for non-computing devices. Over the next four years the Java saga twisted and turned in various directions until finally, on May 23rd 1995, Sun formally announced Java and HotJava at SunWorld '95.

Java Applets - in a nutshell

Java applets are the reason that Java is creating quite a stir within the Web development community. Java applets are, to simply put it, mini applications that execute on Web browsers. These provide Internet sites with real-time interaction with users, live information updating, instant interaction with servers over the network, animation and much more. They are limited to certain operations on the browser, but can also use JDBC connection (to a database) or distributed objects. The biggest advantage of applets is through Java's extensive detail to the user interface. Applets allow more complex user interface options than HTML combined with CGI. To guarantee safety, applets are downloaded into 'safe space' so they can't hurt the client PC.

Advantages of Java over other Web technologies

Some Disadvantages of using HTML with CGI

CGI is not ideal for building large-scale applications. Some of the deficiencies that arise can be fixed using JavaScript or plug-ins. However, this is not ideal. JavaScript does not solve the stateless protocol issues or the dynamic files population issue. One big disadvantage of using HTML/CGI is the lack of many features that are needed for a good user interface. Also, Web page loads and CGI executions are performed using a connection to the server that is opened for the duration of the operation and then closed. Therefore, every other time the CGI executes it has no idea what was previously performed at the last connection. This can be addressed using cookies etc. Java applets, on the other hand, maintain state information.

CGI uses more network bandwidth. Once a Java applet is downloaded, less data is transferred than with the equivalent CGI script. Where Java only needs the data, HTML/CGI requires that the data and its presentation be transferred over the network. For small applications, however, CGI may be preferable.

CGI consumes the CPU. An article written by Caribou Lake software states:

Each time the user presses the submit button the following process takes place. The http server (Web server) must create another process to execute the CGI script. The CGI script then parses the CGI input, connects to the database, does whatever the script is written to do, and then sends a Web page back to the browser.

Each CGI script invocation imposes the overhead of creating a process. Each process generally has a database connection. Many short connections can have a negative impact on performance due to the overhead of creating a database connection in the server and the overhead of authenticating the user.

A client based Java applet moves processing from the server to the client PC.

Object-Oriented Language for Extensive Reusability

Java is an Object-Oriented language. Object-Oriented languages are very powerful. With OO languages it is possible to create objects that represent commonly used things in a business such as a project or an order. These objects are manipulated using methods and their state is stored in variables. Objects, methods and variables are grouped into classes. Every object is an instance of a class. What this means is that objects can be 'bundled' together in a consistent manner. Once a class has been created any number of objects can be created from it, therefore the work only needs to be done once and can be reused many times. Reuse ensures consistency and saves money on application development.

Full Graphical User Interface (GUI) for the Web.

Java is currently the only technology to provide a fully interactive interface for the Web. Java applets are downloaded onto the client and run locally from there. HTML, on the other hand, uses block mode forms, which is not as flexible or intuitive.

Portability

When a Java program is compiled it is converted into byte code and the Java interpreter runs it (this interpreter is on all Java enabled browsers). What this means is that Java can be compiled once and run cross platform. This reduces production cost and promotes the development of code that boosts interoperability of co-operating machines on the Internet. Right once, run anywhere, is a reality with Java.

Security

The Java programming language was designed with security specifically in mind, not as an afterthought. It is claimed that Java provides a simplified and consistent means of protecting your assets. However, the Java security issue is somewhat unclear. This will be discussed later in the text.

Easier Programming

The Java language provides several features that make programming easier. For example:

  • multi-threading
  • automatic memory allocation and de-allocation
  • standardised error trapping and detection
  • distributed processing capabilities.

No Administration

Applets are downloaded onto the users' Web Browser when they are needed. This means that a 'fresh' version is downloaded to the client every time it opens the page the applet is running in. This obviously means developer/client administration is not necessary.

Database Integration

The JDK provides a standard SQL database access interface known as JDBC. This API provides a uniform interface to a wide range of relational databases, including Oracle, Sybase and Access, and provides a common base on which higher level tools and interfaces can be built. JDBC is implemented via a driver manager that can support multiple drivers connecting to different databases on different servers. CGI, on the other hand, requires either that the DBMS server is on the same machine as the Web Server or some networking software is installed on the Web server.

Possible Disadvantages of using Java

For almost a year now, Java sceptics have been warning of 'problems in paradise.' Are these sceptics correct? Lets take a look at the evidence, and any possible solutions that may help solve these problems.

Browser Compatibility

Java should be compatible with most browsers that are Java enabled. Why then will certain applets not run properly, even on browsers like Netscape or Explorer?

The reason behind this incompatibility is the latest JDK release, JDK 1.1. The most up to date books that can be purchased nowadays are all based on JDK 1.1. They make no reference to JDK 1.0, which tends to make programming Java applets that little bit more difficult. Sun advises that, for the time being, when programming applets, use only JDK 1.0. However, what happens if you have purchased some new Java development software that produces code in JDK 1.1? You might think that these applets should run properly on Netscape Communicator or Microsoft Internet Explorer 4, but this is not the case. Even these releases are not yet JDK 1.1 compatible. Scott Pope (5/5/98) of http://www.suite101.com estimates that 'less than 1% of the people out there' have browsers that are compatible with JDK 1.1.

So what's the answer? Seems to be simple! Don't use JDK 1.1 when programming applets, because they won't work on all browsers. When purchasing books or software, as mentioned above, buy older versions. There are, however, patches available that will allow a client PC to run applets programmed in JDK 1.1. However, I feel that it is unrealistic to expect that everyone wishing to use your applet will purchase a patch. More than likely they would sooner turn to another site for help.

There is, however, an alternative approach. Sun claims that "as long as you provide backward compatibility, you can use 1.1 features and still provide applets that prevalent browsers can display." There are several techniques available for this approach. These can be read at

http://java.sun.com/products/jdk/1.1/compatible/index.html

Using Java Applets behind Firewalls

Viewing applets behind firewalls has traditionally been a problem for clients using Netscape browsers. A security error is thrown when a client tries to open an applet that attempts to connect back to the applet's original server. Typically the error shown is #Security Exception: socket.connect:www.machine_name.com-

What's the solution then? According to Wisniewski at http://home.att.net/~wisniewski "all you need to do is edit your local Domain Name Service (DNS) resolver configuration." However there are some glitches with this. Wisniewski says, given an applet on the site http://java.sun.com

The security glitch occurs at the point when a second applet request is made: What is supposed to happen based on any secondary applet request is that the URL request should be rewritten from http://java.sun.com/whatever to http://1.2.3.4/whatever before the request gets passed from the applet to the browser and then to the firewall/proxy server. But the URL request does not get rewritten. The applet request keeps the URL request as http://java.sun.com, which forces the proxy to do another DNS resolution.

Applets Slow to Download

Another issue, which must be looked at, is the download speed. Applets are completely downloaded onto the client PC before running and this takes time. A lot of designers take this into consideration when designing pages and if a solution can be reached just as easily using HTML/CGI, then they will opt for that approach.

However, Java performance is said to be improving at a rapid pace. One article on http://www.javaworld.com states:

One of the many interesting developments on the performance front is the recent announcement by Intel and Novell that they are collaborating on an enhanced Java virtual machine. In mid-June the two companies announced a partnership to create a fast VM (NetFire) for the Intel platform. As a result of this agreement, Novell licensed Intel source code that will enable the company to tune performance for both Intel's 32-bit and 64-bit architectures. While NetFire won't ship until next year, Novell already has one of the fastest VMs for Unix and Windows NT and has demonstrated this performance with the popular VolanoMark benchmarks. In short, Java performance is improving rapidly. It's not yet at the level of C or C++, but both performance enhancements over the next year and the distributed nature of most Java applications will make any remaining performance differential a moot point.

Java Security Issues

It seems that nothing in life is completely secure. Some people feel that Java is less secure, because several sceptics have made comments on the Java "hostile applets" problem. The main worry is that Java code could be downloaded onto the client PC allowing files to be deleted, private data to be read or a virus to infect the client's machine. Potentially everyone running a Java-enabled browser is at risk, which means that this sounds like a serious problem.

So, how common are these breaches? There have been no reported cases of security breaches caused by Java, although some suspicious events have occurred. However, a lack of reported cases does not mean that breaches haven't occurred, although it does suggest that they are rare.

This security problem will never go, just like every other security risk in computing. Nothing is ever completely secure. It is my view that Java is as safe as any other language on the market today and that no-matter how secure it becomes there will always be sceptics.

Conclusion

Sceptics are making many complaints about Java but these are being rapidly addressed. Java is a very young language so naturally it has yet to mature. With regards to security and database integration I feel that Java is a major competitor, however, much remains to be done in the areas of performance and reliability. These problems will be rectified and, in my view, Java will soon become one of the strongest and most widely used languages in the world.

To sum up, here's a quote from Caribou Lake Software. I think it says a lot.

The ultimate goal is to design and develop application systems that will meet today's business needs, easily grow and change as business and technology changes, and co-exist with current products and technology. The secondary business goal is to provide this functionality at the lowest possible cost. When you add it all up the only combination of technology and products that address all of these business and technical requirements is Java and JDBC.

References

The Benefits of Java over other Web Technologies
http://www.cariboulake.com/technoinfo/JavaBenefits.html

Comparison of JDBC and Java to HTML/CGI
http://www.cariboulake.com/techinfo/java_html.html

Frequently asked questions about Java and JDK
http://java.sun.com/products/jdk/faq.html

Are you ready for the Java Backlash?
William Blunden
http://javaworld.com/javaworld/jw-08-1998/jw-08-blundon.html

Java Tip 37: The trick to using Java networking applets behind firewalls
Thomas Wisniewski
http://www.javaworld.com/javaworld/javatips/jw-javatip37.html

Java Compatibility Problems
Scott Pope
http://www.suite101.com/articles/article.cfm/7248

 

 


[ Home ]
[ Documentation ]
[ Partners ]
[ Members ]
[ Publications ]
Last update: 30/05/2001
Editor: Matthew Bond