Friday, February 10, 2006

Features That Ruby Lacks and Java Has

Bertrand Meyer describes in his book " Object Oriented Software Construction (2nd Ed)" qualities that a good object oriented language should have. Java has almost all the features. Ruby is much farther off, which does not mean it is not a good language, I think it's very good to write some types of programs quickly (should I call them scripts?), syntax is quite nice, but it does lack the following useful features:
  • Assertions:
    The language should make it possible to equip a class and its features with assertions (preconditions, postconditions and invariants), relying on tools to produce documentation out of these assertions and, optionally, monitor them at run time. 
  • Information Hiding (Java is not good either on that one, the protected keyword is of dubious value):
    It should be possible for the author of a class to specify that a feature is available to all clients, to no client, or to specified clients
  • Static Typing:
    A well-defined type system should, by enforcing a number of type declaration and compatibility rules, guarantee the run-time type safety of the systems it accepts.
  • Genericity:
    It should be possible to write classes with formal generic parameters representing arbitrary types. 
More pragmatically, library choice and performance difference between Java and Ruby might be the most decisive.

Tags:

Features That Ruby Lacks and Java Has

Bertrand Meyer describes in his book " Object Oriented Software Construction (2nd Ed)" qualities that a good object oriented language should have. Java has almost all the features. Ruby is much farther off, which does not mean it is not a good language, I think it's very good to write some types of programs quickly (should I call them scripts?), syntax is quite nice, but it does lack the following useful features:
  • Assertions:
    The language should make it possible to equip a class and its features with assertions (preconditions, postconditions and invariants), relying on tools to produce documentation out of these assertions and, optionally, monitor them at run time. 
  • Information Hiding (Java is not good either on that one, the protected keyword is of dubious value):
    It should be possible for the author of a class to specify that a feature is available to all clients, to no client, or to specified clients
  • Static Typing:
    A well-defined type system should, by enforcing a number of type declaration and compatibility rules, guarantee the run-time type safety of the systems it accepts.
  • Genericity:
    It should be possible to write classes with formal generic parameters representing arbitrary types. 
More pragmatically, library choice and performance difference between Java and Ruby might be the most decisive.

Tags:

Tuesday, February 07, 2006

What Is "Modern" Java Compilation?

Occasionally in Ant you can see messages like this:
"[javac] Using modern compiler"

What does this mean?

In Ant you have the property " build.compiler" to specify if you want to use a classic or modern compiler. Now what do they mean by modern or classic. Well, they call classic compiler the compilers of JDK 1.1 and 1.2 and they call modern compiler the ones of JDK 1.3+. They made that distinction because a classic compiler does not support the same options as modern compilers: the semantics of javac tool changed in JDK 1.3.

This terminology can easily be confused with java class file compatibility. Java class file compatibility is changed using the "-target" option of javac tool. One can specify in ant to compile with modern compilers and a target 1.4, the result is likely to not run on JVM 1.3. One can specify modern and a target 1.1, the resulting classes will run on JVM 1.1, but ant build.xml file will not be usable with JDK 1.1 without changing modern to classic.

I find Ant choice of word a bit confusing as using a "modern" compiler has little to do with the resulting class files.

What Is "Modern" Java Compilation?

Occasionally in Ant you can see messages like this:
"[javac] Using modern compiler"

What does this mean?

In Ant you have the property " build.compiler" to specify if you want to use a classic or modern compiler. Now what do they mean by modern or classic. Well, they call classic compiler the compilers of JDK 1.1 and 1.2 and they call modern compiler the ones of JDK 1.3+. They made that distinction because a classic compiler does not support the same options as modern compilers: the semantics of javac tool changed in JDK 1.3.

This terminology can easily be confused with java class file compatibility. Java class file compatibility is changed using the "-target" option of javac tool. One can specify in ant to compile with modern compilers and a target 1.4, the result is likely to not run on JVM 1.3. One can specify modern and a target 1.1, the resulting classes will run on JVM 1.1, but ant build.xml file will not be usable with JDK 1.1 without changing modern to classic.

I find Ant choice of word a bit confusing as using a "modern" compiler has little to do with the resulting class files.