Strategy design pattern with Ruby blocks

My last post was about the strategy pattern. The strategy pattern is a great way to vary part of an algorithm, using composition of objects. Ruby allows for a variation on this technique; the variation is to use block objects. Why? Using blocks to vary part of an algorithm is very common in the Ruby… Read More »

Strategy design pattern

As discussed in the previous post, the template pattern has a number of disadvantages due to the fact that it relies on inheritance. The alternative is to use composition over inheritance, that is where the strategy pattern comes in. With the strategy button, you are programming to an interface. In Ruby we have to concept of… Read More »

Template design pattern

I’m currently reading Design Patterns in Ruby by Russ Olsen, which is a book about implementing some of the Gang of Four’s design patterns in Ruby. I shall be summarising what I’ve read in a series of posts and providing some of my own examples. The purpose is mainly to improve my own understanding but I… Read More »

Converting atom plugin from coffeescript to ES6

Recently I converted my cucumber-autocomplete plugin from coffeescript to ES6. Here are 3 steps to convert an atom plugin to ES6: Rename .coffee files to .js files Add ‘use babel‘; to the top of all of your JS files. This will enable babel and allow you to use ES6 Convert your coffeescript code into JS. You can… Read More »

Write atom packages in coffeescript or JS?

At the Facebook event last week, I learned that Facebook are using ES6 to develop their atom plugins. My first thought was to ditch coffeescript and re-write my plugins in ES6. That got me thinking… Why don’t I like coffeescript? Most examples out their are written in JavaScript so you spent a lot of your time… Read More »

Category: JS

What is the gopath and goroot?

GOROOT is the place where go is installed on your machine. GOPATH is used to specify directories outside of the GOROOT that contain the source and binaries for a go project. You can have multiple paths in your go path, separated by ‘:’. export GOPATH=”$HOME/workspace:$HOME/projects”

Category: Go

Mobile@Scale Conference London

Today I attended Facebook’s Mobile@Scale Conference, London 2016. Here is a roundup of the day. Google on iOS by Michele Aiello This was a really interesting talk to kick off the conference. The talk explained how Google writes and maintains apps for iOS and Android. For me, the key takeaways were: Google uses small feature… Read More »

Webserver process vs multithreading

As I discussed in a previous post Ruby MRI is not capable of running multiple threads in parallel. So how can we scale Ruby applications, if we cannot run threads in parallel? Ruby web servers (Unicorn vs Puma) Unicorn and Puma are two of the most popular Ruby web servers. Puma was originally designed for… Read More »

Apipie Rails

Apipie-rails is a fantastic gem for documenting your APIs. Apipie also has some great features which will enable you to write better APIs. This post will discuss the basics of Apipie and how it can be used as a development tool for writing better APIs. How to document your API endpoints Apipie’s DSL can be… Read More »

What is normalization?

The term normalization has a different meaning depending on the context. This is mainly for my own understanding, to get the definitions clear in my head. But I hope that others find this useful. Relational Databases In the context of Relational Databases normalization mean to organize data in a way that eliminates redundant data (e.g.… Read More »