SOLID Design Patterns

5 min. read

S.O.L.I.D. is an acronym for five principles of software design that aim to create maintainable, scalable, and flexible code.

What is S.O.L.I.D

S.O.L.I.D Principles are a set of guidelines for software design, which stands for the following principles:

  1. Single Responsibility Principle (SRP)
  2. Open/Closed Principle (OCP)
  3. Liskov Substitution Principle (LSP)
  4. Interface Segregation Principle (ISP)
  5. Dependency Inversion Principle (DIP)

These principles can help improve the design of video game systems, from a software engineering point of view, making them more maintainable, scalable, and flexible.

Single Responsibility Principle (SRP)

Each class or component in a game should have a single, well-defined purpose and should not be responsible for multiple unrelated tasks.

For example, a class that handles player movement should not also be responsible for managing the game’s inventory system.

Open/Closed Principle (OCP)

A class or component should be open for extension but closed for modification.

This means that the class or component should be designed in a way that allows it to be easily extended or modified without needing to change its existing code.

For example, a game engine could be designed to be easily extended with new features, such as new graphics or audio capabilities, without needing to modify the core engine code.

Liskov Substitution Principle (LSP)

Objects in a game should be able to be replaced with instances of their subtypes without breaking the game.

This means that subclasses should be able to be used interchangeably with their parent classes without causing errors or unintended behavior.

For example, a game could have different types of enemies that all inherit from a base enemy class, and these enemies could be used interchangeably without causing any issues.

Interface Segregation Principle (ISP)

A game should use many small, specific interfaces rather than a few large, general interfaces.

Each interface should be designed to provide a specific set of functionality, rather than trying to provide everything a class may need.

For example, a game could have separate interfaces for rendering graphics, playing audio, and handling input, rather than trying to combine all of these functions into one interface.

Dependency Inversion Principle (DIP)

This principle states that high-level modules (such as game mechanics or AI systems) should not depend on low-level modules (such as input or rendering), but rather both should depend on abstractions.

This means that the game design should be modular and loosely-coupled, allowing for easier maintenance and flexibility.

For example, the game mechanics should not depend on the specific input method (such as keyboard or controller), but rather should be abstracted so that it can be used with any input method. This allows for easier maintenance and the ability to change or update the input method without affecting the game mechanics.


SOLID Principles for Programming and Software Design

S.O.L.I.D Design Patterns - Unity - Single Responsibility Principle

S.O.L.I.D Design Patterns - Unity - Single Responsibility Principle

Becoming a better developer by using the SOLID design principles by Katerina Trajchevska

[Design Patterns(

Book - Head First Design Patterns

Command Pattern

State Machine

Switch Statements

Design Patterns by Jason Weimann: