Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

darobin (1316)

darobin
  (email not shown publicly)
http://berjon.com/

Journal of darobin (1316)

Thursday December 05, 2002
10:24 AM

Java XML support...

[ #9292 ]

...sucks. And today I got tired of it so I (partially) ported XML::SAX::Machines::Pipeline and XML::Filter::BufferText to Java. Boy, life's hard when you don't have AUTOLOAD. Here's a sample from the new fr.expway.sax.filters.BufferText:

    public void startElement (String ns, String ln, String qn, Attributes attrs) throws SAXException {
        sendChars();
        getContentHandler().startElement(ns, ln, qn, attrs);
    }

    public void endElement (String ns, String ln, String qn) throws SAXException {
        sendChars();
        getContentHandler().endElement(ns, ln, qn);
    }

    public void processingInstruction (String tgt, String data) throws SAXException {
        sendChars();
        getContentHandler().processingInstruction(tgt, data);
    }
...

And it just goes on and on... talk about the DRY Principle in action. Compare that with the original. Java is generally anti-DRY, with constructors having the name of the class and other stupidities like Foo foo = new Foo() but I rarely felt it this strongly.

Similarly, in order to make Pipelines work naturally (whereby you can pass in objects or class names), I had to defeat the type system with lovely constructors like new Pipeline(new Object[]{foo, "myClass"?, ...}) and generally do casts from Object into something else the type of which I just tested all over the place, in static arrays.

I am deliberately not releasing this as Open Source. If anyone uses this language for reasons other than commercial, they deserve the pain.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • It's been a while since I looked at Java code. How can you tell what this snippet of code does? There are just too damned many words to parse! How are you supposed to see what it's doing just by looking at it?

    If you need to be using Java, can't you use something like a JScheme, Jython or JRuby to run code within the JVM?

    • I think that Java is a great language for educative purposes, because its verbosity forces you to think about what you're writing, and because it's simple enough to be understood by beginners. However, for serious stuff, I'd use Perl. And before going serious, I'd force people to learn C, because understanding pointers is important. Java seriously lacks multiple inheritance (not speaking about double dispatch) and its core classes (String, Class) are flawed by implementation details and performance consider
    • If you need to be using Java, can't you use something like a JScheme, Jython or JRuby to run code within the JVM?

      I wish, but unfortunately the reason I'm using Java is because I'm doing research stuff, and Java is pretty much the lingua franca. A lot of people think it has serious flaws, but it's the only thing you can use that you're sure all others will understand.

      I guess we better get up to speed with those taking over of the world with Perl6/Parrot ideas ;)

      --

      -- Robin Berjon [berjon.com]