Native Promises vs Bluebird

I’ve been asked, on more than one occasion, about moving to ES6’s native Promises as opposed to using a third party library such as When or Bluebird. In every occasion surprise was expressed when my response was that I intend to continue using Bluebird over native Promises.

Some express surprise over not using native Promises, at times citing concerns that third party Promise libraries might not be as performant as Native Promises but, IMHO, this is a poor decision metric as: a) Promises are mostly used in conjunction with external resources (think DB or API queries) - the bottleneck isn’t the Promise implementation; b) third party Promise implementations are leaner and more performant than Native Promises - at least for now.

My answer always focused on the additional benefits and “sugar” provided by third party libraries when compared to the sparse implementation of Native Promises.

Read More

AngularJS / ES6 / Webpack

I first started using ES6 and Webpack a few months ago whilst working with React on Soapee and ever since I’ve been finding myself missing using ES6 and Webpack when writing code for Node.js and AngularJS.

This posts presents my research on existing ES6/AngularJS seed projects and my own attempts of using ES6 and Webpack on an AngularJS single page application.

Read More

Whilst developing Soapee I received a feature request that Recipes should either be defined as public, private or only visible to friends - by default recipes were public.

Follows is a post on how I modeled Friendships using Bookshelf.js with PostgreSQL in Soapee’s Express based API Server.

But first, a primer on symmetric and asymmetric friendships and their differences.

Read More

This blog post is based on my experiences developing a Commentable widget (more on this later) first using Backbone.js and more recently, AngularJS.

A Polymorphic Commentable Widget?

To be specific, it is:

  • some Javascript + HTML that allows a website visitor to add a comment on a specific page
  • the commenting functionality is not tied to any specific object. In other words, the same code can be used to comment against an Article, a Cat Photo or any business object without any modification
  • the same code should display previous comments in a nested fashion
  • provide a facility to reply to a comment
  • provide a facility to edit or delete any of your own comments

Read More