What are HTML C and Java


1.3 Assessment



1.3.1 Some common misconceptions ...

As already mentioned in the foreword, we would like to join the Java euphoria, but not accept it completely uncritically. This section attempts to provide a brief assessment and to clear up some of the most common misconceptions. First of all, we want to comment on some theses that are repeatedly articulated and often lead to exaggerated or incorrect assumptions about the nature of Java.

Thesis 1: Java == JavaScript

This is completely wrong, because JavaScript is a scripting language developed by Netscape for extending HTML pages. It is syntactically based on Java, but it doesn't offer as many features by far. It is not compiled in bytecode, but interpreted by the browser and does not allow the construction of applets or stand-alone applications. As a script language, it is primarily intended for simple manipulation of the layout and the ability to interact with HTML pages.

Proposition 2: Java is easy to learn

This often repeated thesis from the language description is only partially correct. Java is an object-oriented programming language with advanced features and must be learned like such. It's easier to master than C or C ++, and there's less room for beginner's mistake. The class library is also easier to use because it has been redesigned and does not have the legacy of non-object-oriented predecessors. The compatibility requirements of the meanwhile four JDK follow-up versions (1.1, 1.2, 1.3 and 1.4) are definitely noticeable. Mainly because of the large size of the class libraries, dealing with Java requires a considerable amount of familiarization time before developers can achieve productive results.

Thesis 3: Java is portable

The source code portability of Java programs is somewhat higher on the pure language level than that of C or C ++ programs. This is mainly due to the fact that no explicit pointers or machine-level data types and operators are used. The exact specification of the elementary data types also contributes to this fact.

If, on the other hand, one includes the huge class library with its standard functions on all platforms, C and C ++ fall behind by light years in the portability comparison. Functionalities like Database access, Network programming, Multithreading, Serialization, Graphics programming and many others are already included in the basic version of Java and are available in the same way on all platforms.

Another portability advantage of Java is that the compiled programs binary compatible are. Once a program has been translated, it will run on any platform that provides a Java VM and the required runtime environment. Java programs therefore do not need to be recompiled, as is required with C or C ++ programs.

Thesis 4: Java programs are slow

Since Java programs are translated into bytecode that cannot be executed directly by the processor, an interpreter has to take on this task. This means that CPU-intensive Java programs can be 10 to 20 times slower than comparable C / C ++ programs.

This argument is still often used by the C / C ++ group today. In practice it is put into perspective by several factors. On the one hand, only a few programs are extremely CPU-intensive. Most interactive programs spend a great deal of their time waiting for user input or slow database or hard disk access. In addition, the runtime behavior of Java programs has been steadily improved in recent years through the development of just-in-time compilers, native code compilers or Java processors and is increasingly approaching that of compiled C / C ++ code. The HotSpot compilers, which have been part of the JDK since JDK 1.3, analyze the interpreted bytecode while the program is running and translate particularly computationally intensive parts into directly executable machine code.

The performance problem can therefore be viewed as a temporary problem - if it still exists for the specific type of application. Many observers now assume that Java programs will soon run at the same speed as compiled C / C ++ programs. Benchmarks already show these results in some areas. The initial performance problems of Swing surfaces were also largely rendered harmless with the JDK 1.3 and the current developments on the processor market.

However, the careless developer in Java can very easily contribute to poor performance. If you use the abstract design options of strings, readers or writers, collection classes and many other components of the class library without hesitation, you can seriously impair the runtime behavior of your program. With just a few details about the structure of important JDK classes, the existing libraries can be used much more efficiently and the performance of the programs increases. In Chapter 49 we go into some of these details and show how to write Java programs that perform well for many applications.

Thesis 5: Java is not suitable for serious applications

This claim arises mainly from three observations. On the one hand, many of the applications initially developed in Java had the character of toys or demos. Mostly implemented as an applet, they only had the task of embellishing a homepage or demonstrating the Java skills of their developers. On the other hand, only a few offered real utility, and larger applications that were written entirely in Java were initially hardly on the market. This has now completely changed. There are hundreds, probably thousands, of full-blown Java applications from every imaginable application area.

Second, the look and feel of Java programs was immature. In fact, the AWT only represents a small proportion of the options available in the respective platform-specific window systems. However, the few dialog elements are portable. With the help of the swing tool set, this problem can be seen as solved. Swing offers a comprehensive set of complex dialog elements and makes them available across platforms. It is possible to change the look and feel of the respective application during runtime and thus adapt it to the taste and knowledge of the respective user.

The third observation is that Java is full of bugs. While this is less true of the language itself, its tools, or the elementary properties of the class library, the early graphics libraries could not hide a certain degree of flawedness. There are still bugs in the JDK (all known bugs are in the Bug parade named error database), but these are usually not so serious that a workaround could not be found. In addition, the errors are mostly in the class libraries. The compiler and the virtual machine on which the executable programs run can be considered sufficiently stable for most applications. There are exceptions here too, especially when porting JDK to less common operating systems. On most systems, however, the JDK is an extremely stable, reliable and sufficiently fast development tool in daily practice.

1.3.2 Outlook

If you take user interests as a basis, Java is already by far the most successful programming language in recent years. As shown above, the language has grown immensely in the few years since version 1.0 was released. Java has produced thousands of books and magazine articles, and a number of high-traffic newsgroups have emerged showing interest in Java. All major software manufacturers support the language and have implemented specific products. Most relevant job advertisements require a knowledge of Java.

At the same time as the discussion about the suitability of Java as a development tool for graphical interfaces, a change has taken place on the server side. With the Servlet API and the Java Server Pages For example, techniques have established themselves in the area of ​​generating dynamic web pages that compete with traditional CGI scripting. In addition, large software manufacturers rely on multi-layer client-server architectures with Java support (Oracle Financials, Star Office) or equip their database or web servers with Java capabilities (Oracle 8, Lotus Domino, SUN Java Web Server, Apache jserv ). Many companies already have distributed applications that rely on the cross-platform capabilities and binary compatibility of Java applications.

A trend towards Java has also been observed on the client side for some time. There are "small" Java applications that run on the Palm Pilot, the Psion 5 or in cell phones. But also complex standalone programs such as - for example from the area of ​​development tools - JBuilder, NetBeans (Forte), Together / J or OptimizeIt are now developed in Java. Many companies use Java to increase productivity in the development of graphical user interfaces, or combine frontends written in Java with the existing batch-oriented application and database servers. The switch from C / C ++ to Java often leads to drastic increases in efficiency in the development and porting of complex application systems.

In addition to the cross-platform portability of bytecode and graphical user interface, Java offers things such as database connection, multithreading or network programming without architectural breaks. With the "duty" to program in an object-oriented manner (in contrast to C ++, there is no legitimized Possibility of writing purely procedural programs), the developer has to take a further step in the evolution of his own skills. Applets, servlets and the exchange of bytecode between applications only became socially acceptable with Java. With several million Java developers worldwide, the critical mass for the (irreversible) establishment of these new technologies has been safely reached.

Of course, nobody can say today whether Java will also be successful in the long term and whether it will also play a role as a programming language in ten or twenty years' time. However, the current developer interest, which is still increasing after 7 years, speaks very much in favor of it. Programming languages ​​and methods are not changed overnight, because paradigm shifts take time. Existing source code that has been created with great effort is not simply thrown away. 20-year-old COBOL, RPG and FORTRAN programs are still being maintained today, albeit with a downward trend. Java has not even reached its zenith, and newer Java-based code is still being developed to an increasing extent. So the prognosis can be ventured that Java will also have significant importance in 2010 and beyond.

Those who can fall back on experience in Java programming today may have a decisive advantage in competition with the competition tomorrow.