The Super Mario Game

If you were born in the 1990s then the above picture needs no introduction. It will surely make you go back to those nostalgic memories where the Super Mario game was the only thing to do on summer vacations 😆. The surprising fact of the game is the original file size of the game was a mere 32 KB, less than a modern-day picture! We will learn the state design pattern by implementing a small yet important piece of a Super Mario game. Let’s take a look at what we want to implement.

Requirements

We want to implement the behavior of…


Chamelion adapting to the surrounding colors!

Hello Guys, what’s up? I hope you are doing great and having fun! If you are new to this blog series, I request you to also please check out my other blogs on software design patterns! I have yet another cool design pattern to discuss today — The Adapter Pattern. And the good thing is it is quite simple and easy to understand.

What is an Adapter Pattern?

The adapter pattern convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.

The adapter pattern is a structural pattern. It converts the interface…


After a long pause, I am back with yet another design pattern. Today, we will learn the command pattern with an interesting real-world use case. By looking at the name of the pattern what comes to our mind? Any guesses? Well, a command — An army chief gives commands to their soldiers, a caption commands their crews. Hmm, if you think it should be related to the execution of a command, then you are in the right direction. Suppose there are two objects A and B. A wants to request something from B now, command pattern allows us to encapsulate…


It’s the 1st of January 2021, but most of us are still in party mode! I am sure you must have thought about the new year resolution to accomplish new goals and make this year be the best of your life. I wish you a very Happy New Year 😃. Since our party mode is still on, let’s learn the factory pattern by implementing a use case of an alcohol shop! There are three variants of the factory pattern.

  1. Simple Factory. (Not a pattern, it’s just a programming paradigm.)
  2. Factory Method.
  3. Abstract Factory.

We’ll learn simple factory and factory method…


Last year, I was on a business trip to Mumbai, I was feeling hungry and wanted to order delicious and expensive food 😜. And I was craving for pizza so, ordered Dominos cheese burst pizza along with loads of extra toppings. Of course, it was just as mouth-watering as the above picture! Today, we’ll learn about the Decorator design pattern with an example of pizza. Suppose we are developing a billing software for the dominos. Customers can order their favorite pizza with extra toppings on it. We have different types of base, a variety of toppings that add up to…


Do you want to be a millionaire? Then you are probably in the right place. Because today we’ll reveal a secret to become it. Yes, we are going to learn the observer pattern by using an example of a stock market. We are going to subscribe to a few stocks that will notify us when their price drops below a certain threshold as well as it will also notify when it rises beyond our expectations. You might think that probably, it’s not that easy to earn money from the stock market, I agree, but the observer pattern is pretty simple…


A few months ago, I was in an interview and I was asked a design problem. The problem was asked to check my OOP skills and a general understanding of how does a person thinks on an abstract requirement. I blew my interview and just could not think of any better solutions because I was not aware of the strategy pattern. Here is the problem and let’s see how we can approach it using a strategy pattern.

Problem

You have an API that returns data. As a backend engineer, you need to store it in multiple different types of databases…

Bhuvnesh Maheshwari

Let’s be an awesome developer together! I will be learning the tech and sharing it with the community.

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