Archive for August, 2007

Meet Mr. Jackson

Thursday, August 30th, 2007

Tatu writes:

Developers, meet mr. Jackson: possibly the world’s fastest JSON parser! (and at very least, fastest one written in Java). You heard it here first folks: a new streaming light-weight, and VERY fast JSON-processor (parser+generator) package written from scratch, in Java, is now officially out in the wild. Check out Jackson Hatchery Page for details.

I can’t say enough good things about the software Tatu writes. He’s also the guy behind Woodstox which is bar none the best Java XML parser out there. I’m sure this will end up being the best tool for JSON as well.

Quick Intro to XML performance

Tuesday, August 28th, 2007

Was just writing an email which included a two minute introduction to Java XML performance. I thought I’d quickly replicate it here:

There are a few key areas that I see to XML performance. All can have a huge effect - i.e. you could possibly increase performance 2-10x performance by tweaking any one of these.

1. Your XML parser. By far the fastest here is Woodstox. It is a StAX implementaiton, but it also supports SAX as well.

2. Your databinding implementation. The fastest ones are those that compile optimized xml readers/writers for your domain objects. JiBX is a good example.  SXC (which I wrote) is another. SXC provides compiled readers/writers for your JAXB context, which can speed it up quite a bit. After those two, the JAXB-RI is probably the next fastest. XMLBeans/XStream are mediocre as I recall.

3. The XML representation. Reading everything into a Document object is very memory and resource intensive. Modern databinding frameworks like JAXB, JiBX, etc can turn the XML stream directly into POJOs. Use those if at all possible.

Re: DOoMed

Monday, August 27th, 2007

Elliotte argues to deprecate DOM (via Stefan Tilkov). I totally agree, its probably one of the worst things that has ever happened to Java, let along the multitude of other languages.

A couple thoughts regarding the Java world and DOM:

  • XOM would probably be come a defacto DOM standard for Java if Elliotte licensed as BSD, ASL, CDDL, or CPL. IMO CDDL would accomplish the same aims as LGPL, but it comes without the perception problem and ambiguity that LGPL has. I’ve emailed Eliotte about this many times, but I don’t think he really cares about this issue.
  • The biggest gripe I have with XOM is that it doesn’t use interfaces, which makes bridging different data sources, like W3C DOMs or XML databases, inefficient.
  • Any new DOM standard for Java will need to have a W3C DOM support.
  • Functional but ugly: DOM4J (please use javax.xml.QName), JDOM (probably my favorite out of this list), AXIOM
  • Is it worth starting a JSR to define a better DOM? Will ERH lead it? :-)

Introduction to CXF Webinar

Monday, August 27th, 2007

I’ll be giving an Introduction to CXF webinar with Covalent on September 19th for those who are interested:

In this webinar, Dan will give an introductory view of building services with Apache CXF. He’ll look at the technologies CXF offers and how they can be used within the context of a service oriented architecture. First, he’ll walk through building a contract first SOAP web service with JAX-WS. Then, he’ll look at building RESTful XML and JSON web services with CXF. Along the way he’ll discuss topics such as how and when to use the WS-* standards, how to secure web services, and service design.

Registration is of course free. To sign up, go here!

Ease of development: REST vs RPC

Sunday, August 19th, 2007

Bill (where is that Ó key) de hÓra: “The fundamental problem here is looking for a RESTful way to do RPC/RMI, instead of redesigning the application to expose resources.”

This gets at one of my main problems with getting people to build good RESTful services: it’s a lot of work.

While OO in theory can map pretty well to REST, it takes a lot of metadata and careful thought to turn those objects into resources. Making an RPC application is much easier. This is one of the killer features of SOAP/WSDL. I can take my business service and build a web service out of it with very little effort (I assert that there are non-evil ways to do this, but thats another story). I can then be interoperating with a .NET application in just a minute or two. Or I can take a WSDL, generate a set of objects, and just write some glue code between my internal objects and the web service objects.

Building the RESTful equivalent isn’t nearly as easy IMO. (At least for Java).

I suppose there are two ways to build RESTful services. First, you can turn your interfaces/POJOs into a RESTful service. This requires you to know:

  • The relationships between the objects. I.e. parent/child relationships and primary keys. This would allows basic URIs like /customers/1 or /customers/1/orders.
  • How to map methods on your business interface to resources.

Given a business interface and a set of POJOs, this isn’t quite so easy. Sure, people are working on JSR 311, annotations, etc. But I would like to assert that it will still be harder than building the equivalent RESTful service. At the very least you need to add a bunch more annotations as well as design your URI structure. (JPA annotations may give us some help here in the future - @Id, @OneToMany, etc would give some of the necessary metadata - but not everyone has these annotations on their application. It also seems a little icky to retarget these for RESTful services.).

The other option would be to design your application in a RESTful manner to begin with. I’ll be honest, I don’t have a lot of experience with doing it from the start. Most applications that I encounter have some OO/DAO backend which is exposed through various frontends.

Am I wrong about all this? Should building a RESTful service be easy/easier? (Just for the record - even if it is more work, that doesn’t mean I don’t think there aren’t other more important benefits like scalability)

MuleSource

Tuesday, August 14th, 2007

It’s official, I’m joining up with MuleSource!

In the spirit of self-interviews

Why?

Mule is an open source ESB. Its a great product. Its got a huge community behind it. Its robust. Its got a great feature set. Its got an excellent team developing it. I’ve run into my fair share of installations while consulting. I mean, really how can you not with an install base like this? Its the OSS ESB leader.

What will you be doing?

I’ll be bringing Mule and web services more closely together in a variety of senses. Stay tuned for more info.

And of course I’ll still be blogging here and talking at conferences about web services and the like.

Will you be working on CXF still?

I’m not dying or falling off the face of the earth, so I’ll still be active in the CXF community.

etc.

If I wasn’t able to tell you personally, I apologize, its been a busy time for me.

Personal email is now officially dan AT netzooid.com and MuleSource email is dan.diephouse AT mulesource.com.

Wish me luck as I move forward!

What is the web framework du jour for Java these days?

Sunday, August 5th, 2007

I hate building webapps. I’ve even gone so far as to swear that I would never work on another.

I guess I lied as I need to select a web app framework for an application.

I’m poking around at frameworks, and well, I’m lazy. Maybe you can help. I’m thinking of:

  • Stripes - James raved about it a while back. Possibly shiny object of the day though.
  • Struts 2 - Hooray for simple action based frameworks.

Things I’m not thinking about:

  • Tapestry - sorry Howard, my mind doesn’t work like yours.
  • Seam - Its JSF, which seems (no pun intended) to mean it will still suck. Is everything still required to be a POST?
  • jRoR - I’m not ready to introduce a new language into the mix
  • Grails - see above
  • Spring Web Flow - seems to require a helluva lot of XML. I could be wrong.

Thoughts?

Random tidbits

Sunday, August 5th, 2007

Fake Steve

Ahhh crap - Fake Steve has been revealed and he works for Forbes. I was hoping the revealing would be more dramatic than this. Maybe involving lawsuits. Will it keep its charm? Or will it turn into a Forbes marketing ploy? Whatever the outcome, Jaysus, we need more posts with Bono!

Dopplr

I started using to Dopplr to track all my trips and my friend’s trips. The interface kinda sucks, but my life is still better off with it than without it. My #1 feature wish is for the ability to give trips names. I.e. get Septemeber 13 & 14 to be called “JavaZone” instead of “Oslo, Norway” in my calendar.

I have several invites if people want to join up. I recommend it especially if you travel a lot and like to see who will be where you’re travelling. If you’re already on there, add me as a fellow traveller!

Conference Season

Speaking of travelling, there are too many conferences coming up: JavaZone, QCon, Oredev, ApacheCon US, OS Summit Asia, and possibly others…

CXF 2.0.1

We’re voting on it right now. Well technically the Apache Incubator PMC members are voting on it. Hopefully it will pass in a day or two. If all goes well we’ll have a follow up release with bug fixes and new features in under 5 weeks! Pretty good, eh?

Its also our one year anniversary - check out Dan Kulp’s retrospective for a good recap!