[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Article for Slashdot: Oracle for Java



On 06-Sep-98 Shlomi Fish wrote:
A lot of nonsense. But I'll try to be constructive...

> virtual machine. Thus, they can hide such machine-code derived 
> problems of buffer overflows or assigning values to the NULL pointer: 

These problems are solved also in compiled languages that have true
arrays (unlike C/C++ arrays which are basically pointers to array base).
As one example you may take Pascal (the original version before Borland
messed with its type safety). As another example you may take ADA. Both
languages won't let you overflow an array (bounds checking) and in both
a dereferencing of NULL pointer (named 'nil' in Pascal) results in the
runtime trapping of the error.

> Java is one such technology, but is hardly the only one. Other such 
> technologies include Perl, Python and Tcl/Tk. From what I know of 

You rightly mentioned the "correct" four tools. The common features to
all four:
        1. Were developed in Unix
        2. Are multi platform tools
        3. Have GUI toolkits
        4. Are OOP tools nowdays (Although Java/Python were designed
           ahead as OOP languages, while Tcl/Perl had the OOP features
           added as an afterthout).
However there is one important difference:
        Perl/Tcl/Python are scripting language while Java is a strongly typed
        compiled language.

For the implication of this difference: read on.

> Java's features as a computer language, it is my belief that it is not 
> suitable as a basis for a full-featured object-oriented database 
> server. If Oracle proceed with their plan, I predict that:
...a lot of profecy removed...

> It's not that I don't like Java. It's a cute language, but it's 
> clearly a language for toys: small client-side or serve-side applets 
...some unbased judgement as well...

Now we get to the meat :-)
> In Java a two-dimensional array has to be initialized with the 
> following statements:
> int array[][] = new int [] [10];
> for(int a=0;a<10;a++)
> {
>     array[a] = new int [10];
> }
> 
> And if I later need to resize it beyond the 10*10 boundary... oh well. 

This strictness of the Java compiler is exactly what makes it for day to day
hacks and it is exactly what makes it a great language (much better than
C++ for example) for real world (i.e: large) projects written by many people
working together.

You gave an excelent example:
> In Perl any array can have an unlimited number of dimensions and an 
> item can be written at any coordinates. For example:
> 
> my (@array);
> $array[100000][5000][87778787] = 3;

A simple typo like:
 $array[100000][50000][87778787] = 3;

Have you noticed the extra '0' I inserted ? How many people would spot it
in their own code (let alone someone else's code). The false code is
perfectly legal because you are not REQUIRED to declare your variables.

> separately. The Java statement "MyClass New = Old" will result in two 
> references to the same physical object. 

That's because of the reference semantics (which is very good BTW) but:
        my $a = $b
Does exactly the same in Perl if $b is a reference. Similar, ain't it?

Now for some more code fragments:
> Java:
> 
> Int ref;
> for(int a=0;a<mytable.getRecordsNum();a++)
> {
>     ref = (Int)(mytable.getRecord(a).getField("myfield"));
>     ref.fromInt(ref.toInt()+1);    
> }

This is a perfect example of non-OO programming style (in an OO language).
In OO if "myfield" may be incremented it would provide an 'inc()' method
so you would get:
        mytable.getRecord(a).getField("myfield").inc();

> And in perl:
> foreach $r ($mytable->@records)
> {
>     $r->{"myfield"}++;
> }

Hmmm...Now put a nice typo like "myfied" instead of "myfield". Now
try to debug your 1,000,000 lines database application. What would
be quicker?

> I wonder what will be easier to understand. Java's object-oriented 
> programming is based on the Smalltalk school of OOP and is very 
> restrictive: objects can only be single-inherited, operators cannot be 
> overloaded, no pointers to methods, strict data-typing etc. Perl 5 has 

Good: That's how I like my tools to be when I build BIG applications.
      I want to catch most errors at compile time and not on the customer
      site. (BTW: operator overloading may be nice feature (not always though)
      but has nothing to do with OOP).

> much more flexible OOP capabilites, and for a large-scale project such 
> as modern RDBMS, I believe both its programmers and the users who will 
> want to script it will appreciate it. Perl also has some advantages 

You don't seem to understand what a large project is. What is a large project
for you? 1,000 lines of code? 10,000 lines of code? These are toys.
Run 'wc -l *.[chs]' recursively on the Linux kernel source tree (And Linux
has a small kernel to our happiness) it's more then 500,000 lines of code.

> Java's I/O mechanism is quite awkward with names such as 
> FileInputStream, BufferedOutputStream, or ServerSocket for some of the 
...ignoring some arguments about choosing a computing platform
by the names of its methods...

> believe most people who used UNIX recently will say the same. Perl5 is 
> an amazing language, with superb system-integration, extensibility and 
> embeddebility, AI-like features, a good security mechanism and on top 
> of all a nice C-like syntax.

All true but not relevant.

> be able to act as its own RAD. UNIX users write Perl scripts that 
> perform complex and simple data manipulation, even with simple 
> flat-file records, and if the perl programmer will be able to access a 
> state-of-the-art database engine and SQL interface at the tip of his 
> hands: the sky is the limit.

You can do it now with 'ties' to all kinds of databases and DBD/DBI interfaces.
This has nothing to do with the language used to develop the database itself.

> When I joined the Java Developers Connection some weeks ago, my 
> registration was handled by a script ending with the ".pl" extension - 
> a clear indication that it was a perl script. If the webmasters of 
> JavaSofts' website preferred to a perl script over a Java servlet for 
> the simple database-related task of registering a new developer entry, 
> then how can anyone except an entire database server to be programmed 
> and maintained with Java?

Just proves the this people (unlike you) know to choose the right tool
for the task. Perl is very good language for scripting and small system
programming task. Java is very good language for BIG projects (although
the developement tools in the market are not always of a matching
quality).

> I realize that many newbies believe Java to be "the language of the 

Talking about newbies, I wouldn't through stones out of a glass house :-)

> It is my belief that no single computer language is suitable for all 
> purposes, especially Java with its so many inherent restrictions. And 

Now you're talking! well done.

Summary:
        Although you may think I object Perl, its the contrary:
        I do teach Perl and Java (among other things) for a living
        and I write daily Perl code more than Java code because of
        the obvious benefits you have mentioned: rapid scripting,
        good text processing facilities, no need to declare things etc.

        Java and Perl do not compete because they don't play in the
        same yard. Java is NOT a scripting language and trying to
        push it to something similar (creating animated applets etc.)
        is a poor usage of its merits.

        Java is a strongly typed, OO and platform neutral language:
        This is why it fits so nicely to large scale programming.
        It is in this field that it may have the most significant
        impact, and that's why M$ trys to push it back to the playground
        of "yet another Internet applet platform" where it's just
        another tool.

        

----------------------------------------------------------------
Oron Peled                             Voice/Fax: +972-4-8228492
oron@actcom.co.il                  http://www.actcom.co.il/~oron

Linux is a trademark of Linus Torvalds in the USA and other countries.