GPL and ExtJS for Intranets

My latest thought about ExtJS going GPL. Although ExtJS is GPLv3 and the developers claim (falsely) that your backend needs to be GPL too when generating code that contains ExtJS, for internal/intranet applications you still can use ExtJS as you're not distributing ExtJS.

When people don’t understand GPL and LGPL – or – ExtJS is history

The people behind ExtJS are funny. First they have changed their license to the LGPL, without understanding it in any way, now they've changed it to the GPL without understanding it in any way. They claim that server side code which creates HTML pages which contain ExtJS must be GPL, wuahahaha.

I've been running LGPL and GPL open source projects for several years, had lots and lots and lots of discussions about the very fine points of the LGPL and GPL and let me tell you the ExtJS guys have absolutely no clue. Which is a shame because ExtJS was a nice library. Now they're history. No sane company will touch a project which changes it's license frequently and has such an attitude towards the - dangerous - GPL.

Update: My latest thought. Although ExtJS is GPLv3 and the developers claim (falsely) that your backend needs to be GPL too, for internal/intranet applications you still can use ExtJS as you're not distributing ExtJS.

Update 2: A little madness has a nice analyis on the switch.

REST: Lean JSON and XML from the same code

Generating JSON and XML with the same code is difficult. One can create the semantically richer XML and convert it to JSON, but JSON notations for XML like Badgerfish look quite ugly to JSON advocates.

The problem at the core is that XML is typed whereas JSON is not. Every node in XML needs a type - it's name - for example <item><id>123</id><item>. JSON doesn't need such a type, { id: 123 } is fine for an item. { item: {id: 123}} looks too verbose. Especially getting to the data in Javascript: var id = The same goes for accessing arrays with var id = items[0]; instead of var id = items[0].id;. The problem exists with other dynamic languages and data structures too, see Cobra vs. Mongoose for Ruby.

As I currently develop a REST based Jersey application in Java I needed a way to generate lean JSON and XML. Wouldn't it be best to have one code for both? DRY. My previous solution for generation JSON worked fine. The $(...) method calls create a node tree with nodes and lists. With a JsonRenderer and the Visitor pattern I generate JSON from the node tree. The problem was that this Java code

  $("id", listId),

creates nice JSON like { id: 123, items: [ ... ] }, but was unable to generate XML. As written above, the outer list has no type and a XmlRender therefor cannot render <shoppinglist><id>123</id>...</shoppinglist>.

The solution I thought about is to add type information to nodes which have no names.

$( type("shoppinglist"),
  $("id", listId),

The implementation uses a simple static method and a Type class.

public static Type type(String name) {
    return new Type(name);

The type is attached to the node and if the node has no name but a type, the XmlRender uses the type instead of the name. The JsonRender doesn't use the type information and renders the same JSON as before. The piece of Java code now generates XML


and lean JSON where neither shoppinglist nor item has a type

{ id: "123", items: [ { id: 234, price: "", shop: "", description: "Apple"}, { id: 233, price: "", shop: "", description: "Banana"} ]}

Next thing is to automatically apply the right renderer, toXml and toJson from within Jersey. The content negotiation then choses the accepted format for the client. Attributes (Meta-Information?) are not solved yet and I'm not sure if they are needed, or how to nicely add meta information to the $(...) tree. There is some discussion in the context of markup builders and attributes on James blog.

Probably the code will be released as an open source RESTkit if someone is interested.

Thanks for listening.