Category: Patterns

Asynchronous programming with Async / Await and the Scala Play Framework

Asynchronous programming has a number of advantages, most notably is its well touted ability to improve responsiveness. Asynchronous events occur independently of the main program flow and asynchronous actions are executed in a non-blocking, lock-free manner. This, ultimately, allows the main program flow to continue unimpeded, without blocking. On the flips side, asynchronous programming can be difficult to reason about. Many actions are often run simultaneously which can lead to...

JavaScript: Observer Pattern / Publish-Subscribe

In this post, I will describe how to create a reusable implementation of the Observer pattern (also known as Publish-Subscribe or Dependents (1)). This implementation can be applied to any JavaScript object to instantly make it observable! The implementation can also be used to create a global topic registry. First, what is the Observer Pattern? The Observer Pattern, as described by the ‘Gang of Four’, defines a one to many dependency...

Applying the Builder Pattern

The Builder Pattern is a design pattern used to separate the construction of a complex object from its representation, so that the same construction process can be used to create different representations. [1] Usage The Builder pattern is useful for constructing complex objects. It enables one to build a complex object without exposing the details of the object’s parts or how the object’s parts are assembled. Also, as noted previously,...

Stubs and Skeletons

What are stubs and skeletons? At times, it is easy to confuse what is intended when a software engineer refers to stubs and skeletons. If you have been confused in the past, you are not alone. The meaning of these terms differ depending on the context. Stubs and skeletons are primarily used in two contexts, 1. a software pattern and  2. distributed computing Let’s start with the software pattern. 1. As a Software Pattern: Stubs...