joachimhs / Hyrrokkin

Hyrrokkin is a Java library to convert POJOs into a JSON feed that Ember Data can consume via its RESTAdapter. The name Hyrrokkin comes from Norse and means "Fire-smoked". Hyrokkin is also a dark, shrivelled giantess that helped get Balders ship Hringhorni rolled out to sea. (http://en.wikipedia.org/wiki/Hyrrokkin)
Other
15 stars 3 forks source link

Jackson and other guidelines #3

Open miguelcobain opened 9 years ago

miguelcobain commented 9 years ago

I'm very interested in this project because I'm using Java as a backend for my Ember app (I'm using Jackson). I'd be very happy to invest some time on this.

What do you think of implementing this project as a Jackson serializer/deserializer + annotations? From what I can tell, Jackson has some performance advantages over Gson, and it is used as a default in many web frameworks, but maybe Gson has some advantages as well.

joachimhs commented 9 years ago

What would the advantage of Jackson give as opposed to the Gson library that's already included?

Ideally, though, Hyrrokkin should support a pluggable JSON-library, so that the use can choose which one they prefer.

miguelcobain commented 9 years ago

Ok, I can see this project following one of two paths:

  1. Using a JSON-library, i.e. we use the library to build our JSON, but the "client" of our project never knows about which library we use
  2. Extending a JSON-library, i.e. we extend a library using some

Currently this project is using the first approach, it seems. However, I would rather use something like the second approach.

Jackson (and Gson, from what I read) has the notion of Serializers and Deserializers itself, through pluggable modules. Example: https://github.com/FasterXML/jackson-datatype-hibernate This is a jackson module that enables support for hibernate datatypes. Something like that could be done for serializing json that ember expects.

Another advantage of the second approach is that many frameworks (spring, JAX-RS stuff, etc) are completely prepared for Jackson, for example. I don't need to do anything to serialize my entities with Jackson out of the box. Using something custom, like the first approach, would require more configuration, probably.

Also, AFAIK, Jackson is one of the most performant JSON libraries out there. But I have no concrete proof of that.