Transforming one entire data structure to another...  You've landed
yourself right in the middle of functional programming's sweet spot. :)

There's a number of options, so grabbing the available drivers from here (
http://www.mongodb.org/display/DOCS/Drivers) and filtering to just the Java
platform:

Java: Officially supported and mature.  Would seem at first glance to move
you out of your comfort zone, but to get FP you'd need either google-guice
or lambdaj.  Juice is enough of a paradigm shift that you're practically
learning another language anyway, and lambdaj needs you to set up support
in your IDE and build system.  Most boilerplatey of the alternatives.

Scala: Also officially supported (via the casbah drivers) and extensively
used within 10gen (mongodb maintainers).  Hands down offers the best range
of collection-manipulating options compared to the alternatives, and
pattern-matching capabilities are perfectly suited to the task.  Expect the
same performance as Java.  Requires you to learn another (java-esque)
language, which should be a similar level of difficulty to learning a broad
framework like guice and the associated FP paradigms.

Clojure: Community supported. Should yield the most concise solution and
dynamic typing fits will with untyped JSON data.  Will be slower than
either Scala or Java and has a heavy up-front cost of first learning
Clojure (which is a lisp variant)

Groovy: Will be the least performant option, with the least support for
richer FP constructs.  Worth considering if you already have a lot of
in-house Groovy talent, but certainly not worth learning the language for
this task, especially not given the advantages of the alternatives.


I could probably whip up a couple of comparable examples if you can explain
the exact transform in a bit more depth.


On 25 January 2012 21:04, Rakesh <[email protected]> wrote:

> Hi,
>
> I need to develop an app that will take data in one database and
> transform it and put it into another database.
>
> The databases are MongoDb storing JSon data.
>
> I could just do it in Java, converting the Json in Java objects,
> transform them and then convert the resulting objects back into JSon
> for inserting into the other database.
>
> Anyone have any ideas for doing it any other way? The requirements:
>
> 1. Developed using proper tooling - none of this Vi/Emacs/Non-GUI
> crap. I use IntelliJ.
> 2. Needs to be unit testable
> 3. Performance is key
>
>
> Thanks
>
> Rakesh
>
>

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to