Next: News Server Architecture
Up: Design
Previous: Design
We cannot decide for a programming language based on the News Cache's
design alone because the programming language has to fulfill the
following criteria:
- Availability
- The programming language must be available on a
wide set of platforms since the News Cache should be available for
as many platforms as possible. In addition free implementations of
the chosen language should exist, since we want to make this
software freely available under the terms of the Gnu Public License
(<http://www.fsf.org/copyleft/gpl.html>).
- Acceptance
- The programming language has to be widely accepted
since the user installing the News Cache should be able to compile
the source code (binaries cannot be made available for all systems)
and be able to apply minor code fixes in case of problems.
- Optimization
- Compilers producing highly optimized code should
be available. Interpreted languages usually have a worse
performance, because of the interpreter's overhead. Hence we will
not consider languages where only interpreters are available (such
as Perl [WCS96], Python ([vR97]
and [Lut96]), Tcl [Ous94] and others).
The following languages fulfill these requirements.
- C
- The GNU C Compiler , a freely available and well
optimizing C compiler as well as commercial C compilers are
available for nearly any platform. C has the advantage that it is
widely accepted and that most NNTP Software (e.g., INN [Sal92],
tin, etc.) is written in C. One disadvantage of C is that it is
neither object-based nor object-oriented. This makes it difficult to
write objects with similar behavior without unnecessarily
duplicating the source code.
To test the suitability of C we wrote a small news cache with very
basic functionality only. Even this small program got rather
complex. We had to decide whether to implement lists for several
types or to use only one list structure and make heavy use of the
cast operator. Both methods are error prone.
- C++
- The GNU C++ Compiler , a freely available, optimizing
C++ compiler as well as commercial C++ compilers are available for
most platforms. C++ has the advantage that it is object-oriented and
allows to define algorithms and objects in a type independent way
using templates. Unfortunately C++ is not as widely available and
accepted as C. Since C++ has completely been standardized only a
short time ago [ES90], many C++ compilers do not
implement all aspects of the C++ standard.
To test the suitability of C++, we ported our test program written
from C to C++. As expected the code to handle different types of
lists got smaller and was easier to understand.
- Java
- Java is a relatively new programming language that has been
introduced by Sun Microsystems ([GJS97]
and [AG97]). Java is similar to C++, except that
pointers have been eliminated and the explicit memory allocation has
been replaced by an implicit one as found in Lisp or Prolog. Its
advantage is that compilers for an abstract machine and for native
code exists. This means that the News Cache can be run without
compiling the source code on any computer where the interpreter for
the Java Virtual Machine is available. However, with the cost of
much performance.
For our implementation we have chosen to use C++ in favor of Java,
since C++ compilers are wider available and have a much better
performance and acceptance.
Other languages like Objective C, Smalltalk , Pascal, Modula 2, and
similar languages have not been considered, because of their
restricted availability and acceptance.
Next: News Server Architecture
Up: Design
Previous: Design
gschwind@infosys.tuwien.ac.at