Prototype pattern is a software design pattern that lets you copy existing objects without making your code dependent on their classes.

Photo by Omid Haghighatgoo

1- Brief Introduction

Prototype pattern is a software design pattern that lets you copy existing objects without making your code dependent on their classes. It is used when the type of objects to create is determined by a prototypical instance, which is cloned to produce new objects.

Prototype pattern is categorized as creational pattern same as singleton and factory design pattern.

The beneficial of this pattern is:

  • Avoid subclasses of an object creator in the client application, like the…

Tomb of Hafez (photo by Omid Haghighatgoo)

Brief Introduction

Template pattern is a software design pattern that an abstract class defines template methods which can be override by subclasses as if it is necessary. The template methods may be either abstract methods, or hook methods.

· Abstract methods means that subclasses are required to provide concrete implementations.

· Hook methods are those that have empty bodies in the superclass

Template pattern is categorized as behavioral pattern same as observer and memento design pattern.

Template Design Pattern

  • Problem: Imagine you want to develop a service for clients. First the user should be authenticated. If the user is premium…


In this article we review most important interview questions about Observable, Memento, Template, Strategy and Singleton design patterns.

Fin Garden (photo by Omid Haghighatgoo)

1- What are design pattern?

Design patterns are solutions used by expert for general problems. These solutions are accepted as best practices by experienced developers and software architects. Design patterns doesn’t depends on programming languages, and they can be implemented by almost all languages.

2- Name three types of design patterns and talk about them?

Behavioral patterns: Those patterns that are about concerning with communicating objects with each other.

Creational patterns: Those patterns that are about creating object with hiding logic. In…


Singleton design pattern is one the most useful and well known pattern that every developer should know.

Persepolis (photo by Omid Haghighatgoo)

1- Brief Introduction

  • Singleton pattern is one of the simplest design patterns in software engineering. It is a design pattern that restricts the instantiation of a class to one “single” instance. This pattern involves a single class which is responsible to create an object while making sure that only single object gets created. It comes from the mathematical concept of a singleton which means a set with exactly one element.
  • There are two main reasons for this pattern:

1- Ensure that the class…


photo by Omid Haghighatgoo

Brief Introduction

Strategy pattern is a software design pattern that enables selecting an algorithm at runtime. In this pattern you define a group of algorithms and put each of them into a separate class, and make their objects interchangeable. Instead of implementing a single algorithm directly, code receives runtime instructions as to which in a group of algorithms should be use.

For example, a class that is for validation on incoming data may use the strategy pattern to select a validation algorithm depending on the type of data, the source of the data and so on. These factors are not…


Implementing memento design pattern using java 11

Memento Design Pattern Implementation in Java 11

1- Brief Introduction

The memento pattern is a software design pattern that is used to store and restore an object to its previous state. Memento pattern is categorized as behavioral pattern same as observer pattern.

2- Memento Design Pattern

  • Problem: It’s very easy. Have you ever seen undo button in any application?

A little more technical means storing state of an object step by step so we can restore it to any step any time we want.

  • Solution: Memento Design Pattern!!!


Implementing observer design pattern using Observer and PropertyChangeListener

Observer Design Pattern

1- Brief Introduction

First let’s see what design pattern is. In Wikipedia design pattern is defined like this:

In software engineering, a software design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design. It is not a finished design that can be transformed directly into source or machine code. Rather, it is a description or template for how to solve a problem that can be used in many different situations. Design patterns are formalized best practices that the programmer can use to solve common problems when designing an application or system…


making an existing angular project to a progressive web application

progressive web application with angular
  1. Brief introduction
  • A progressive web application (PWA) is a type of application software delivered through the web, built using common web technologies including HTML, CSS and JavaScript. It is intended to work on any platform that uses a standards-compliant browser, including both desktop and mobile devices.
    While web applications have been available for mobile devices from the start, they have generally been slower, have had fewer features, and have been less used than native apps. PWA features narrow the gap between user experience in web-based and native applications. …

Omid Haghighatgoo

Senior Software Engineer with a demonstrated history of working in the information technology and services industry.interested in AI and machine learning.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store