Skip to main content

5 posts tagged with "creational-patterns"

View All Tags

Singleton pattern

· 3 min read

banner

The objective of this post is to explain and show how to implement the Singleton Pattern in a basic way.

Pre-requisites

Check all the description and information related to the Singleton Pattern and return here to see a practical example.

Description

In your immersive fantasy game, players embark on epic quests across mystical realms, each connected by magical portals. These portals serve as gateways between worlds, allowing adventurers to traverse vast landscapes, encounter mythical creatures, and uncover ancient treasures.

However, there's a problem lurking in the enchanted fabric of your game world: every time a new portal object is created, a new portal springs into existence. This seemingly innocuous behavior soon spirals into chaos as the game progresses:

Abstract Factory pattern

· 6 min read

banner

The objective of this post is to explain and show how to implement the Abstract Factory Pattern in a basic way.

Pre-requisites

Check all the description and information related to the Abstract Factory Pattern and return here to see a practical example.

Description

You're crafting an immersive gaming experience where players are transported to a vibrant world filled with diverse civilizations. Two of these civilizations stand out: the Technocrats, with their sleek, futuristic technology, and the Druids, guardians of ancient wisdom and nature's secrets.

Prototype pattern

· 3 min read

Panik

The objective of this post is to explain and show how to implement the Prototype Pattern in a basic way.

Pre-requisites

Check all the description and information related to the Prototype Pattern and return here to see a practical example.

Description

Let's suppose that we are using a graphic design tool like Adobe Illustrator or Sketch.

In these applications, users often create complex graphical objects like icons, logos, or illustrations, which can have various configurations and styles. Rather than creating each graphical object from scratch every time a user wants to use it, the Prototype Pattern can be employed to clone existing objects.

Builder pattern

· 5 min read

intro

Image made by piercless

The objective of this post is to explain and show how to implement the Builder Pattern in a basic way.

Pre-requisites

Check all the description and information related to the Builder Pattern and return here to see a practical example.

Description

In the world of Konosuba, building an effective adventuring party is no easy feat! You need to consider various roles, attributes, and maybe even questionable quirks. The Builder pattern provides a flexible solution to create personalized adventurers.

Factory pattern

· 4 min read

The objective of this post is to explain and show how to implement the Factory Pattern in a basic way.

Pre-requisites

Check all the description and information related to the Factory Pattern and return here to see a practical example.

Description

Suppose a company has different levels of employees: Junior, Mid-Level and Senior. Each level has a different base salary. We want to implement a system that calculates the salary of an employee according to his seniority.