list of structural design patterns

12 Essential Structural Design Patterns

By Matthew Thompson
AD

In the realm of software development, structural design patterns provide proven solutions to recurring problems. They offer tested, modular solutions to design issues, making your code more flexible, maintainable, and understandable. Here, we explore a comprehensive list of structural design patterns, categorizing them based on their fundamental behaviors, and delving into examples and implementations.

Structural design patterns focus on how to compose objects into larger structures while keeping these objects independent of each other and the structures that contain them. This article aims to provide a solid foundation for understanding and applying these patterns in your software design.

Decorator Pattern

The decorator pattern attaches additional responsibilities to an object dynamically. It provides a flexible alternative to subclassing for extended functionality.

AD
an assortment of different patterns and shapes
an assortment of different patterns and shapes
What Are Design Patterns? Understanding the Basics
What Are Design Patterns? Understanding the Basics
a black and white photo of the side of a building with vertical lines on it
a black and white photo of the side of a building with vertical lines on it

Here's an example in Python, where a parenting responsibility is added to an employee object:

Employee and Parent

First, let's define our basic employee and parent roles:

Geometry in Architecture: A Designer's Guide (2026
Geometry in Architecture: A Designer's Guide (2026
Illustrator Patterns - Building Materials
Illustrator Patterns - Building Materials
a diagram showing different types of tiles
a diagram showing different types of tiles
  • Employee: A basic employee with a job title.
  • Parent: A role that extends the employee with additional responsibilities, like attending parent-teacher conferences.

Now, we can create these classes:

class Employee: def __init__(self, title): self.title = title def work(self): print(f"{self.title} is working.") class Parent(Employee): def __init__(self, title): super().__init__(title) def take_to_school(self): print(f"{self.title} is taking the child to school.")

Applying the Decorator Pattern

To apply the decorator pattern, we'll create a Decorator class that wraps an existing employee and adds new behaviors. Here's how:

AD

First, we need a new interface for our decorators:

black and white photograph of the inside of a building with geometric designs on it's walls
black and white photograph of the inside of a building with geometric designs on it's walls
the front cover of an article with different patterns and lines in black, white and grey
the front cover of an article with different patterns and lines in black, white and grey
How to Read Structural Drawings A Beginner's Guide for Civil Engineers
How to Read Structural Drawings A Beginner's Guide for Civil Engineers
Log in
Log in
an abstract black and white background with hexagonal shapes in the center, on top of each other
an abstract black and white background with hexagonal shapes in the center, on top of each other
class EmployeeDecorator: def work(self): pass

Then, we can implement our parent decorator:

Again, note the use of the super().__init__(employee) line, which initializes the decorator with the wrapped employee. This ensures that the decorator has access to the methods and properties of the employee it decorates.

AD

Adapter Pattern

The adapter pattern allows incompatible interfaces to work together. It wraps an interface to provide a different interface that a client expects.

Here's an example in Java, where we have a class that requires a specific interface, but we only have an implementation that matches a different interface:

Adapter Interface and OldClass

First, let's define our required interface and the old class that we want to use:

AD
  • RequiredInterface: The interface required by the class that calls our functionality.
  • OldClass: The class we want to use, but it doesn't implement RequiredInterface.

Next, we'll implement the adapter class:

Finally, in our main class, we can use the adapter to bridge the gap between the old class and the required interface:

RequiredInterface adapter = new OldClassAdapter(new OldClass()); adapter.requiredMethod();

A real-world example of this pattern would be integrating legacy software with a modern API. The legacy software might have a different method naming convention or require different inputs than the modern API expects. In this case, an adapter would translate between the two.

AD