Java

Tenets: PORT, FLAT, REUSE, trees, parallel, hier

Central concept: Choose portability over efficiency.

Sun Microsystems' Java programming language has been a phenomenon in its own right. As the heir apparent to the portable-language-of-choice throne once held by the C programming language, it has firmly established itself as the de facto language for new application development today. It isn't perfect, and it has its quirks. Yet, it is rapidly being adopted by the application programming masses.

Sun's promotional message, "write once, run anywhere," speaks resoundingly of the value of portability. And while Java is more portable than C, it is only about 95 percent as efficient. Given the aforementioned advantages of Java's portability, however, it's difficult to understand why anyone would worry about the 5 percent loss in efficiency.

Still, old habits die hard. For those purists who insist on wringing every last bit of performance out of the hardware, C is still the language of choice, as it is for many Linux developers, especially those working on the Linux kernel. That's okay. Comparatively speaking, only a handful of people actually work on the kernel. The largest group of developers by far comprises those cranking out applications to run on Linux and Windows platforms. For them, Java fits the bill quite nicely.

In promoting Java as an open standard, Sun has done a reasonable job of walking a fine line between proprietary control and open-source flexibility. Many developers question Sun's motives for retaining strong control over Java's fate and would prefer that the evolution of Java be managed by a publicly accessible open-standards body. But we'll leave those issues to the marketers and strategists and instead focus on the technical and philosophical aspects of the language.

Code reuse is very popular among Java programmers, largely due to its object-oriented architecture. Through hierarchical inheritance mechanisms, most Java classes take advantage of code written by someone else in the inheritance chain. New classes are often extensions of existing classes. Sun's marketing notwithstanding, this ease of reuse has caused Java to gain rapid, widespread acceptance.

Java adheres to the Unix philosophy tenet of flat-file usage with its property file mechanism. Whereas in some application environments the configuration information is stored in binary files, Java property files are ostensibly human-readable. Text search engines on a system can also index them, making it easy for developers to locate any property in an environment in a moment.

Java does more than pay lip service to parallel operations. Its core classes include a set of objects for creating and manipulating threads. Hence, many Java applications written today are multithreaded. This is not always a good thing, as some developers have found plenty of ways to abuse this mechanism. But in general it has served the Java community well.

Another step in the right direction is Sun's Javadoc. This tool generates API documentation in HTML format from the comments in the source code. Since the output is HTML, most Javadoc documentation is viewed using a Web browser, rather than by printing the documents themselves. We're saving forests by the hectare here.

With all of the things that Java does right, is there anything that Java does wrong? Of course. While C had the dreaded #include directive that was responsible for endless name collisions between variables, Java has found a way to reinvent this nightmare with its classpath mechanism. Time and again, we see programmers struggling with the same kinds of issues with classpaths as the C programmers did with the #include directive. Maybe someone will invent a solution to this problem someday. In the meantime, we're stuck with it.

Finally, the issue of who controls Java keeps rearing its ugly head from time to time. Many hardcore Linux developers eschew Java because it isn't open source in the way that they think that open source ought to be. This kind of thinking may be too restrictive. Sun Microsystems acts as a kind of benevolent dictator with respect to Java. It makes the sources available to anyone who wants them. It responds to suggestions and criticism. It simply wants to retain some measure of control over them to be sure that they are not polluted or absconded with by another entity.

That other entity is Microsoft. Sun is playing a life-or-death chess match with Microsoft, struggling to wrest control of the development environment from the software behemoth. Meanwhile, Microsoft has attempted to upset the Java juggernaut with the introduction of .Net and its own C# programming language. Will Java survive the onslaught of these? Most likely it will. Java is perceived as being more portable than anything that comes out of Redmond, regardless of the marketing hype. And there is a large community of developers who believe that portability is more than marginally useful.



Linux and the Unix Philosophy
Linux and the Unix Philosophy
ISBN: 1555582737
EAN: 2147483647
Year: 2005
Pages: 92
Authors: Mike Gancarz

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net