Noob vs Nodejs ORMs(Caminte/Sequelize/node-orm2)

Well, as they say, once you use DB in your app, you will look for ORM! And it happened to me obviously. So what’s so special or different in this post? Well, nothing really. It’s just my perspective, a Java Dev’s perspective, on the ORM eco-system of Node.js. We, Java Guys, rely too much on ORMs. Be it Spring, Play or any framework for that matter, will come bundled with ORM! But not in Node.js. This was a big blow. When I chose Expressjs, I thought I don’t have to write plain DAO like codes anymore, but how wrong am I?

It’s not that writing plain SQL is harder, but it feels too much painful. Too painful, that I have to open a connection, execute statement, close it! Eew, Seriously? People still do that? Anyways, my search started. So like all, I got sucked up into Sequelize with their shiny new home page and all those jargon’s! It all went smooth. It was so smooth, I felt like I can relax now because at this rate I’ll finish the app much before I thought. But boy, Sequelize said NO!

See the thing is, I don’t want to dig SOF or any forums to know simple thing. It should be in the documentation. And when I try to insert inside another insert and it failed with no error, this is a big RED symbol. I debugged, and cried a lot, but no help. So there I am, sitting and crying at 1 AM! So with heavy heart, I decided to go with Caminte, after looking at another shiny page! Same old, Same old. So I thought why not open a Issue! Well, it wasn’t what I expected. No one replied. Well, with last release couple of months ago, and lot of open issues with no response, I decided to knock it off from list.

The bad thing is, Caminte looked like a serious contender in the ORM race. It had all I need, but not support. So while at work, I glanced upon node-orm2. No shiny page, just simple github template. But still I thought, why not? And to my surprise, it did the trick. With such minimal documentation, it just explained things clearly. No hiccups anywhere and debugging was a lot easier compared to those 2 guys! So what was this all about? Me, bitching about famous Nodejs ORM FW for fun? Nope. There are reasons why I am writing this at 2 am. If it ain’t work, then go for the once which work. And that’s what I did. I tried hard to use them, but either due to my sheer negligence or my noob-ishness might have cause some errors, but logs are supposed to be there to give exact error. It is how we fix them and move on. This got me thinking, how come such big popular ORM’s left out such major part? Or am I missing something? Whatever it is, I did the same with all 3 and node-orm2 performed to my expectation. Which means. this guy gets it!

  1. ORM frameworks ecosystem is matured, but not to the point where we can take them to any project as I do with likes of Hibernate!!
  2. Logging is the key! Don’t overdo the documentation. If logging is perfect to the sense, every single activity is logged, it will be lot easier to debug without any help. Rather than look up SOF for everything I prefer to do it this way.

These 2 points, I feel is rather very important. I mean, whats the use of giving OBD port, when I can’t get error codes to debug? So I suggest them to improve their logging mechanism, which is a boon rather than giving a whole lot of FAQs and tutorials and putting out answers in SOF! This isn’t healthy.

Well, I maybe wrong. Maybe JS Guys like it this way, but I don’t. And if something works for me out of the box,  nothing matters. Not even support. I stayed with JDK 6 until a year ago. Yes, that’s cold, but that’s how it works. So I wish, Caminte and Sequelize step up their game and bring some new features along with proper way to debug.

NOTE : This was my short term observation. Opinions may change, once I get hold of these FWs and this is not intended to berate anyone or any Entity(Pun intended!). This post gives you a brief of how noob friendly these FWs are! And for me, if a noob can do it in a short time, it tends to be a better one(Not applicable to all things!).