Basic Javascript Patterns

Nov 13, 2015 - 4 minutes
Javascript is quite a loose language, its possible to do things in a bunch of different ways. This tends to lead to developers coding themselves into a corner with custom patterns that seem clunky. Below are a few of the patterns that are often seen in Javascript development, use these as a reference if you’re unsure about how to write a Javascript module. The module.exports property and the require function are found in either Node. Read more ...

Data Access Patterns

Sep 24, 2015 - 11 minutes
I recently got into a conversation with a colleague about system design and testability. One of the fun asides we got into was about data storage and why we use repositories. Below is my best attempt at explaining what I consider to be the main three data access strategies used in modern times. Repositories Query Objects Active Records This code is written using Dapper and AutoMapper. MySQL connections are created in the service layer, coupling the service with the persistence technology; you don’t have to do this but it keeps the examples concise. Read more ...

MongoDB Driver with F#

Jul 17, 2015 - 2 minutes
I had a bit of difficulty today using MongoDB in F#. This is just simple explanation of my ‘Get all’ function for posterity. let getAllShips (database:IMongoDatabase) = let collection = database.GetCollection<BsonDocument> "ships" let wildcard = FilterDefinition<BsonDocument>.op_Implicit("{}") collection.Find(wildcard).ToListAsync() |> Async.AwaitTask |> Async.RunSynchronously |> Seq.map mapDocumentToShip |> List.ofSeq Let’s go through this code line by line. let getAllShips (database:IMongoDatabase) = In the new MongoDB Driver 2.x, MongoDatabase is exposed as IMongoDatabase. As everything is explicit in F# we have to use the interface here. Read more ...

Coffeescript - Javascript Made Pretty

Jun 14, 2015 - 5 minutes
I’ve been writing a lot of Coffeescript lately. For a long time I avoided it, it looked all weird and scary but, once I finally bit the bullet, I realised its actually a rather pretty language. Below I’ve highlighted some of my favourite parts of Coffeescript but it is in no way a complete guide. To learn more about Coffeescript, check out the excellent homepage at http://coffeescript.org/. You will find a detailed list of features, along with their Javascript alternatives, and also a neat sandbox for trying out the language and immediately seeing the output Javascript. Read more ...

Service-oriented Hackathon

Feb 11, 2014 - 8 minutes
Last week my company held its quarterly hackathon event. A hackathon is a time for developers to try out some of those things they think would be a great idea but which may be difficult to get on to the official roadmap. As all of our products live in the cloud, my team's project was to spike a distributed service-oriented architecture (or SOA), similar to the way Netflix operates. Read more ...