Archive - June 2016

Comprehensive object enumeration in JavaScript

This cool JS snippet implements enumerations for JS:

function makeEnum(idField, indexField) {
  idField = idField || 'id';
  indexField = indexField || 'index';

  var enumeration = [];

  // Standalone object is useful for Underscore collection method usage,
  // for example:
  // _.keys(MyEnum.dict);
  var dict = {};
  enumeration.dict = dict;

  // This method can be used as a callback of map method:
  // var objects = ids.map(MyEnum.get);
  enumeration.get = function(id) {
    return enumeration[id];
  };

  // Registers a new enumeration item.
  enumeration.register = function(instance) {
    instance[indexField] = enumeration.length;
    enumeration[instance[idField]] = instance;
    dict[instance[idField]] = instance;
    enumeration.push(instance);
    return enumeration;
  };

  // Maps enumeration as dictionary:
  // MyEnum.mapDict(function(value, key) { return ...; });
  //
  // This is a shorthand for the next Underscore expression:
  // _.chain(MyEnum.dict).map(function(value, key) {
  //   return [key, ...];
  // }).object().value();
  enumeration.mapDict = function(iteratee, context) {
    var result = {};
    for (var id in dict) {
      if (dict.hasOwnProperty(id)) {
        result[id] = iteratee.call(context || this, dict[id], id, dict);
      }
    }
    return result;
  };

  return enumeration;
}

Read More

SaaS Application Development Java

Reasons for SaaS:

So you’ve decided your software product needs to be a SaaS application development Java. You’ve no doubt picked SaaS because your customers would like a cloud based application that they can access from the web anywhere they need it. This also implies your customer base has no interest in maintaining an IT staff to maintain software and equipment in-house. They are also interested in the low cost of ownership, on demand scalability, tailored Service Level Agreements, and the fact that “someone else” is worrying about upgrades, feature development, security, and all the other responsibilities that come from in-house development.

SaaS application development Java community ecosystem

SaaS Strengths (courtesy of Rishabh Software)

Read More