JavaScript Promises – Gotchas and Anti Patterns

tl;dr

  • Flatten the Promise chain whenever possible
  • Straighten multiple nested promises with q.all() and q.spread()
  • Don’t break the Promise chain. Make sure that the last promise is returned to the caller.
  • Don’t overuse deferreds. Use them to promisify callback functions. In case a function returns a promise, it’s just better to form a chain with that same promise.

The long version

Continue reading

Midas : On-the-fly Schema Migration tool for MongoDB released!

Indeed I feel happy to announce that we have released Midas, an on-the-fly schema migration tool for MongoDB.

This is a moment of rejoice for my team and myself here at Equal Experts India, where I am currently heading the RnD efforts.
This is our second open-source product after Tayraan incremental backup and restore tool for MongoDB – was released last year. Continue reading

Fun with Scala Implicits

On this current project of mine, I wanted to provide operations like adding / removing a field or adding / removing multiple fields to a BSON Object (from the BSON library – org.bson.BSONObject) along with operations like toBytes on it. Instead of creating a utils class that contains all these behaviors, I resorted to Scala’s Implicits. Continue reading

Validations with Ember.js

These days, with the rise of the single page applications, there has been a steady rise in the number of complete websites that are built on a client side JavaScript framework.
At any given point of time, these sites have always had the need for validations that they need to run client side.

Recently, while working on a pet-project using Ember.js as the client side framework and jQuery for running my client side validations, I came across a rather interesting question.
How would you handle client side validations with a framework such as Ember.js?  Continue reading