CouchDB or Java which one should I hate?

Never been a fan of RDBMS no sirree. But that has never stopped me from using them (but with many repitions of the phrase ‘databases suck’). Then along came non relation databases and then no-sql. For a while I had to modify my phrase to ‘SQL Databases suck’. But it wasn’t long before I started dabbling with Amazon Simple DB and that turned me off no-sql completely (back to databases suck). That too was quite a while ago, then I had another look and ran into CouchDB.

CouchDB looked promising at first glance. After all It based on JSON. JSON is probably the best thing that happened to programmers since caffeine. It’s pretty easy to work with in most languages, which in turn makes CouchDB easy to work with as well. Not that I did say most languages instead of all languages. Java is the exception. There isn’t built in support for JSON encoding and decoding as you might find in many other languages. It’s pathetic when you consider that JavaFX looks a lot like JSON/Javascript in drags. But then, JavaFX and Java are estranged members of the same family.

So if you want to use CouchDB in a Java app. you need to rely on a third party API or create one on your own – the trouble with most third party APIs is that it’s easier to create your own than to understand those APIs. That’s because there are at least 17 different ways in which any simple task can be accomplished with Java – Sun (Oracle) usually recommends the most complicated approach. API developers take it upon themselves to create a solution that somehow seems to include elements of all those 17 different solutions into their library. Thus something that can be done in 20 lines of code actually takes 210 and you need as many sleepless nights to read and understand the documentation. That’s exactly what happens with CouchDB.

There are five different APIs recommended by CouchDB for use with Java. Each one uses a different API for JSON encode/decode, for logging and for the HTTP Stuff. If you want to use SSL, that’s also implemented differently. When Oracle eventually kills java, I am sure no one will cry. But some people might cry because java is now open source, which means can be forked to infinity. What’s worse, there are far too many java like languages around already.

So CouchDB or Java? which one should you hate? I think Java

Nov 13th, 2010 | Posted in Database, Java
  1. mavvi
    Dec 8th, 2010 at 19:09 | #1

    “Java has no built in support for JSON…” ?!

    Sorry but that argument is just so lame. Almost nothing is “built into” Java! Same goes for a lot of real programming languages, e.g. Python’s (non-natively compiled) extension classes..

    In the future one of the JSON implementations might succeed in being included with the standard Java class libraries: javax.json.* ;-)

    But still, developers will have the option of chosing their prefered driver. What is wrong with that?

  2. admin
    Dec 8th, 2010 at 19:35 | #2

    Almost nothing is “built into” Java!
    Thank you , you have summarized it perfectly. Don’t know what other languages you have looked at but there are plenty around with loads of stuff built into them.

  3. foo
    Feb 1st, 2011 at 20:08 | #3

    “you need to rely on a third party API or create one on your own – the trouble with most third party APIs is that it’s easier to create your own than to understand those APIs”

    well, that’s exactly the semtiment that spawns those many 3d party apis …

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>