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.

Advertisements

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.

How to save and load objects to and from file in Python via facilities from the pickle module

There are times when it is more convenient for us to choose object serialization over database management systems for the persistency of the data that our Python scripts work with.

In this post, I document how we can save and load objects to and from file in Python using facilities from the pickle module.

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.

Advertisements