Ways to implement the Singleton pattern in Java

After you got started with Java programming, chances are you will want to use some design patterns to organise your Java classes.

One common object oriented design pattern is the Singleton pattern. The Singleton pattern is a technique where you can apply to ensure that there is only one instance of your Java class per runtime.

The Singleton pattern is usually used for grouping functionalities that allow callers to act on a single set of state. Examples of cases where the Singleton pattern can be applied include:

  • A class that keeps track of a customized configurations from a configuration file.
  • A class that facilitates interactions with a database system.
  • A class that performs logging.
  • A class that caches data read from previous database calls.

This post documents some ways to implement the Singleton pattern in Java.

Types of interfaces in product and process architectures

In the parlance of system architecture, an interface is a point of contact between interacting system elements and other subsystems or environment at the system boundaries. Interfaces can also be seen as contracts definitions between elements that are interacting with one another.

Interfaces between interacting system elements are known as internal interfaces while interfaces with other subsystems or environment at the system boundaries are considered as external interfaces.

This post documents the types of interfaces that we will typically find in product and process architectures. Note that the types are not mutually exclusive; an interface can be in the form of different types.

The blind men and the elephant – A story that portrays the situation of having differing views

In life, it is inevitable that we have to interact with people who have differing views on issues that we had not encountered before. This post documents a parable, the blind men and the elephant, that describes such situations in an interesting way. I also include some of my afterthoughts to hearing this story.

Getting started with Java programming

The Java programming language is a powerful tool for people to get computers to help perform work on behalf of humans. Since its inception, it had been well adopted by many companies in the creation of many great services and technologies.

This post is for my younger self and people who wanted to get started in learning Java programming but find it hard to get started.

How to prepare the operating system to run your Raspberry Pi, with your Windows machine

Recently, I had been deploying several pieces of Raspberry Pi around my house for different purposes. In order to use Raspberry Pi as a TV Box, a CCTV, a LEMP server or any other appliances, we will need to prepare an operating system in a microSD card to run our Raspberry Pi.

I always use my Windows machine to prepare the operating system for all my Raspberry Pis, since I find that it is easiest to write an operating system for Raspberry Pi on a Windows machine. This post documents how I would prepare the operating system to run my Raspberry Pi with my Windows machine.

Setting up Nginx server on Windows 10

Recently, I got my wife an Asus ROG GL552VW-DH74 15-Inch Gaming laptop as a development machine (so that I can have a machine to use when I feel like gaming). Since the nginx server is one of my favorite servers for building web applications, it is something that I will always setup first when I get a new development machine.

I will set up my nginx server to listen on port 80 and serve as a reverse proxy to web applications listening on other port numbers. And since the ROG GL552VW-DH74 15-Inch Gaming laptop came with Windows 10, this post documents the steps that I went through to set up nginx server on Windows 10.

Understanding Graham Wallas’ four stages of creativity

When I am not sitting on my couch watching movies from my Raspberry Pi TV box, there is a good chance that I am in the midst of creating something new.

Whether it is coding a new functionality or writing a new blog post, I would inherently follow through four stages to bring about my creation. These four stages of creativity process became apparent to me through a lecture on how to manage creativity in an organisation.

According to Graham Wallas, the four stages of creativity :

  1. Preparation
  2. Incubation
  3. Illumination
  4. Verification

In this post, I document the Graham Wallas’ four stages of creativity so that I can be more productive during the creation of new things.