Learn: Structural Patterns in ES6+ using Game of Thrones

Riccardo Canella
Javascript by doing
5 min readOct 22, 2021

--

In software engineering, a Design Pattern describes an established solution to the most commonly encountered problems in software design. It represents the best practices evolved over a long period through trial and error by experienced software developers.

In this article we will talk about the Structural Design Patterns.
Structural Patterns are design patterns that ease the design by identifying a simple way to realize relationships among entities.

The most common Structural Patterns are:

  • Adapter
  • Decorator
  • Façade
  • Flyweight
  • Proxy

Adapter Pattern

The adapter Pattern is a structural pattern where the interface of one class is translated into another. This pattern lets classes work together that could not otherwise because of incompatible interfaces.

Let’s pretend that the Targaryen house wants to go to war with all its strength, both the Unsullied and the Dragons, but Daenerys wants to find a unique way to ask both of them to kill someone.

According to the “Adapter” pattern, we will need:

--

--

Riccardo Canella
Javascript by doing

Riccardo Canella @ricanella92 Love #basket, #bike and #HIMYM since my childhood. #Fullstack #Javascript addicted - https://canellariccardo.it