Asynchronous Control Flow Patterns

In the previous post, I covered how to avoid common pitfalls when using Promises. In this post, we’ll look at how Promises and JavaScript’s collection manipulation functions (read map and reduce) can be combined together to implement a few async control flow patterns. Continue reading

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

Unit testing responsive apps with Cucumber Tags

“Unit Testing”, “Responsive Apps” and “Cucumber”…. do these dots connect ?

Recently we developed a customer facing Java web-app for one of our clients. It was targeted for multiple platforms & devices and therefore, had to have a responsive UI.

After some study on device types and browser support (for JS / HTML 5/ CSS 3) we decided to serve 3 variations of our UI based on device screen size and JavaScript / CSS support. Continue reading

Object Oriented Design…. think before you leap !!!

As I learn and discover more about functional programming each day, I personally feel that have I wasted these many years (over 15+) in working with objects and object orientation… It does leave me frustrated to an extent, but hey, its never too late to pick up things.

I just feel bad that with typical web apps what we really do is take the data, convert it to object hierarchy and graphs and eventually persist them in some Relational DB using an OR mapper; only to be read back as some view or to be iterated over a collection of objects for projections or aggregated views. Just makes me feel stupid….all these years, did I do that type of work and get paid? Continue reading