Class hierarchy design

For the love of all that is dear to software development avoid parallel but separate class hierarchies.


Today we’re going to talk a little bit about type hierarchy design and why composition is useful to consider in certain scenarios.

Read more

Share

NodeJS counter implementation

Performance counters can be implemented in applications to help operators determine where bottlenecks are in the design. Microsoft has a decent page, that’s somewhat Windows centric, about performance counters. This post is about implementing the most basic type of counter, a value which monotonically increases, in JavaScript for NodeJS and the performance implications of different designs.

Read more

Share

Building it wrong and wronger

A 1st generation software product will likely miss the mark. It might have missed being that best that it could be by costing too much, being too complex, or just not targeting the right market. In any case, a 1st product may lead to another, 2nd, product that is cheaper, simpler, or just hits the right notes with the intended customer. Today’s post is about building the wrong product (the 1st one) in the right way so that the 2nd product can be built better, faster.

Read more

Share

NodeJS modules should export object constructors

Note I didn’t say always should export objects, but for the sanity of everyone involved, in many cases a required module should return a constructor and not a fully instantiated object. Today’s post is about why your NodeJS modules should look like this:

/**
 * @constructor
 */
function myConstructor(someDependency) {
   /* setup my object here */
}
module.exports = myConstructor;

and not this:

var myObj = {
   myService: new MyService()
};
myObj.myFunction = function(foo) { /* do stuff with foo here */ };
module.exports = myObj;

Read more

Share

Logging and Monitoring

Read more

Share

SRV records as service locators

Recently I began work on a project to manage the deployment of a product built using a microservices architecture. As a result of our chosen architecture we have a large number of services which will communicate to each other over HTTP/S. Instead of using fixed IPs we decided to used DNS SRV records to indicate where services could contact their dependencies. Today’s post goes into using SRV records in a little more detail and the problem they solve.

Read more

Share

Loading a Cocos Studio scene into cocos2d-x 3.4/3.5

In the last few weeks I have been slowly learning about the cocos2d-x framework. cocos2d-x is a C++ based cross platform game engine. The makers of the engine also produce a UI creation GUI called Cocos Studio. Today’s post is a brief one about loading scenes from Cocos Studio into a cocos2d-x based application.

Read more

Share

Loops in NodeJS

I’ve written before about how it’s better to write straightforward code than trying to be clever and pre-optimize. Another example of where this rule is true is the cost of iteration between different styles of array loops in JavaScript when executed within NodeJS.

Read more

Share

The importance of being mindful of operator precedence

Operator precedence determines the order Operator precedence determines the order and binary operators are executed. In many situations, knowing basic mathematical operator precedence (for +,-,*, etc) is enough. In other situations not knowing the specifics of language can lead to hard to find errors. Quickly, in JavaScript what does 'the boogeyman ' + false ? 'is scary' : 'is not scary' evaluate to?

Read more

Share

Using Olingo ODataJS 4 Beta with AngularJS and Web API OData V4

Recently I started writing a new web application which uses OData V4 as the protocol for passing data to back and forth between the JavaScript client and ASP.Net server. The client is written using AngularJS which doesn’t have any built-in facilities for working in OData APIs. In order to avoid writing my own OData message handler I used the Apache Olingo library to handle the grunt work of sending requests and receiving responses. I wanted to encapsulate the Olingo library in an AngularJS service in order to make using it easier, the following post details how this was done.

Read more

Share