CL/CLOS and Java

Popular in the media and in the internet developer community, Java™ is a new, lightweight, object-oriented language widely used for building internet/intranet applets. Likely as a result of its popularity, we are often asked to explain how Allegro CL works with this hot new technology. The following article discusses the Java language and where it is designed to be used, and where (in comparison) Allegro CL is best used. In general, the familiar phrase "use the best tool for the job" is highly applicable: Java and Allegro CL are different tools designed for very different purposes.

What is Java and Where is it Best Used?

Java was initially designed by Sun Microsystems as a simplified derivative of C++ for developing small, portable, distributed, real-time embedded systems for consumer electronics devices. When opportunities for this particular use of the language fell through, Sun introduced Java to the public in May 1995 as a tailor-made language for internet development. It was offered over the web as a product that programmers could download and use for free. Netscape Communications soon thereafter announced that its Navigator™ browser would support Java, and the rest, as they say, is history.

Java is now widely used for developing applets for the internet and intranets. Applets are small, lightweight applications that can be downloaded into web browsers on remote machines via the internet or a corporate intranet. Java applets compile into architecturally neutral bytecodes which are then interpreted by the Java "virtual machine" (JVM) which is supported by the browser or operating system of the client.

This ability to be downloaded via the internet universal host into any machine running a browser gives Java its highly touted platform neutrality advantage ("write once, run anywhere"). However, the very features that provide this and other internet-specific advantages also bring a number of drawbacks. Because Java is not a compiled language, for example, there is a negative impact on performance. According to Sun's numbers, Java applets interpreted by the JVM generally run anywhere from 5 to 20 times slower than programs written in compiled languages. Just-in-time (JIT) bytecode compilers can improve the speed of Java applets to run anywhere from 2 to 4 times slower than programs written in a compiled language. This, however, is still not fast enough for many business applications.

In addition, the Java language is not ideally suited to building large, scalable applications. Why? Largely because it is not a truly dynamic object environment. While Java does support some dynamic features (such as limited dynamic extensibility), it has limitations usually associated with static object languages such as C++:

  • Java does not support dynamic typing: programs cannot define types at runtime
  • Java does not enable you to modify or mix together classes at runtime
  • Java does not allow you to dynamically add or extend methods

The end-result? As with C++, when developers want to modify classes at runtime, they must take the system down, recompile and restart. With large, multi-developer projects, bottlenecks can easily occur as runtime bugs are detected and fixed. Java applications require rebuilding every time the class structure behavior changes. Rebuilding multi-megabyte applications with hundreds of thousands of objects and classes is an extremely slow process at best, making large interactive applications development difficult. While Java is ideal for smaller applets where these problems do not show up, larger systems software applications are best handled with a truly dynamic object development tool that provides the flexibility to modify or mix together classes, or dynamically add methods at runtime, without long restructuring and recompilation cycles.

The Java Beans™ component API is one of Sun's answers to building more full-scale Java applications. Java Beans is an architecture- and platform-neutral API for creating and using Java components (widgets, applets or small applications) together within a larger application. Another Sun product, Joe™, links Java applets running on the desktop directly to the business applications on Sun's proprietary Solaris NEO™ servers, via an Object Request Broker (ORB) which is downloaded into the client browser.

The Java Beans API and the Joe product will enable the linking together of applets so that they can share and exchange data with network business applications. These technologies ultimately do not offer the best solution for developing sophisticated systems software, however. Systems software typically must model and simulate complex problem domains, often demanding knowledge- or rules-based processing and sophisticated abstraction capabilities. This kind of applications development, as noted above, is more successfully accomplished with a truly dynamic object environment.

In summary, for the internet-specific advantages of portability, platform neutrality and security, Java is extremely compelling. For scaling applets up to full-blown, complex systems software, though, Java and its associated products are not currently the best tools for the job.

How Does Allegro CL's CL/CLOS Compare to Java?

Java and Allegro CL's CL/CLOS are similar in many ways. In fact, Java is essentially a subset of CL/CLOS with special features that tailor the language to internet applet development, while CL/CLOS retains important dynamic features for complex systems software development. Both languages are object-oriented, and both require a runtime kernel: Java applets require the virtual machine, and CL/CLOS applications require a runtime library of generic functions and data types. Some dynamic features are also shared by both languages.

For example, the widespread appeal of Java has worked very much in Allegro CL's favor by popularizing support for dynamic object language features such as automatic memory management and dynamic loading. Sun has championed automatic garbage collection (periodic freeing of memory not being referenced) as a means of making the programming task easier, and also dramatically cutting down on bugs typically encountered with languages such as C and C++. By drawing attention to these and other limitations of the once-almighty C++, Java has newly emphasized the value of features which Allegro CL has had for years.

On the other hand, Allegro CL has advanced dynamic features that are not included in Java. Allegro CL and Java are different tools designed to accomplish different programming tasks. While Java is an evolutionary advance over C++ designed for portability and platform independence, Allegro CL's CL/CLOS is a true dynamic object language designed for high performance, mission-critical, complex systems software development. Advanced features such as class evolution, metaobject protocols (MOP) and object behavior which depends on the runtime environment make CL/CLOS ideal for modeling and simulating complex business problems.

In addition, CL/CLOS is designed to compile to the native machine instruction set, making it very fast. CL/CLOS applications are as fast (if not faster) than applications of similar complexity written in other compiled languages such as C++. And CL/CLOS scales up to large applications. Large teams of programmers working in areas such as mechanical CAD, operating systems, process control, knowledge representation, document management, and telephone switch programming use CL/CLOS to handle incremental development. Existing CL/CLOS applications have hundreds of thousands of objects and use gigabyte address spaces.

One final and very critical area of difference between the two languages is history. Java is a relatively new and untested technology, used tentatively for experimental purposes or for small internet applets such as web animations. The tension between Javas charter to be small, lightweight and portable and Sun's desire to make Java into a truly general purpose applications language could take awhile to resolve. It may be some time before Java can approximate CL/CLOS (or, for that matter, C++) in delivering high performance, large and complex applications. CL/CLOS is an ANSI-standard, mature, proven programming language with many commercially successful applications, most of them large-scale and mission-critical.

Java promises better development environments and more libraries in the future. It has a much better object design than C++ and may ultimately prove more scalable than C++. Given its improved object model over C++, its rapid adoption by many vendors, and the large number of people working towards overcoming some of its limitations, Java will certainly be a technology to watch.

As Java becomes more tested in full-scale commercial projects, it will likely be used with other languages such as C++ or CL/CLOS where its particular strengths can be leveraged. For example, enterprise-wide systems deployed over corporate intranets benefit greatly from a mixed mode development environment. The intranet GUI downloaded into the client browser can be written in Java and linked to the back-end CL/CLOS systems which handle the mission-critical, knowledge- or rules-based processing. This is similar to the way in which CL/CLOS applications currently interoperate with GUIs written in C++ or C Another example is the use of the Java APIs, which can be accessed and leveraged from within CL/CLOS in the same way that existing C and C++ libraries can be used.

Positioned strongly for internet/intranet distributed application development, Java is certainly a compelling technology. Java fever is sure to continue as more and more developers jump on the Java bandwagon and Sun's full component-based architecture is implemented. Allegro CL's CL/CLOS, positioned just as strongly in a different "space" - for core development of complex systems software - will be increasingly linked to Java components for platform-neutral deployment of these systems via the internet/intranets as this technology evolves.

Copyright © 2019 Franz Inc., All Rights Reserved | Privacy Statement Twitter Google+