Details
Here is a complete overview of Design Patterns and related topics for Unity. The repo is complete with code samples.
Enjoy!
S.O.L.I.D. Principles make software designs more understandable, easier to maintain and easier to extend. As a software engineer, these 5 principles are essential to know! (See ITNext.io)
Name | Description | Code Sample Complete |
---|---|---|
Single Responsibility | One reason to change. | ✅ |
Open/Closed | Open for extension, closed for modification. | ✅ |
Liskov Substitution | Subtypes must be substitutable for their base types. | ✅ |
Interface Segregation | No client should be forced to depend on interfaces they do not use. | ✅ |
Dependency Inversion | High-level modules should not depend on low-level ones; both should depend on abstractions. | ✅ |
These patterns provide solutions to common design problems and are a foundational part of software design knowledge. There are 3 types.
- Behavioral Patterns - Design patterns to deal with object-object communication. (See Wikipedia)
- Creational Patterns - Design patterns to deal with object creation. (See Wikipedia)
- Structural Patterns - Design patterns to deal with object-object relationships. (See Wikipedia)
Type | Name | Description | Code Sample Complete |
---|---|---|---|
Behavioral | |||
Chain of Responsibility | Passes request among a chain of objects. | ❌ | |
Command | Encapsulates a request as an object. | ✅ | |
Interpreter | Provides a language interpreter. | ❌ | |
Iterator | Sequentially access elements in a collection. | ❌ | |
Mediator | Centralized external communications. | ❌ | |
Memento | Capture and restore object's internal state. | ✅ | |
Observer | Notify changes to its state. | ❌ | |
State | Alter behavior when its state changes. | ✅ | |
Strategy | Encapsulates algorithms using strategy pattern. | ❌ | |
Template Method | Defer exact steps to subclasses. | ❌ | |
Visitor | Add new operations without altering a class. | ❌ | |
Creational | |||
Abstract Factory | Creates families of related objects. | ❌ | |
Builder | Separates object construction from its representation. | ❌ | |
Factory Method | Creates objects without specifying the exact class to create. | ✅ | |
Prototype | Clone or copy initialized instances. | ❌ | |
Singleton | Ensures a class has one instance. | ✅ | |
Structural | |||
Adapter | Matches interfaces of different classes. | ❌ | |
Bridge | Separates an object’s interface from its implementation. | ❌ | |
Composite | Tree structure of simple and composite objects. | ❌ | |
Decorator | Adds responsibilities to objects dynamically. | ❌ | |
Facade | Simplified interface to a subsystem. | ❌ | |
Flyweight | Reuses objects by sharing common state. | ❌ | |
Proxy | Represents another object. | ❌ |
- Editor Scripting - Unity lets you extend the editor with your own custom inspectors and Editor Windows and you can define how properties are displayed in the inspector with custom Property Drawers. See Unity Docs for more.
- Unit Testing - Software testing where individual units/ components of a software are tested. The purpose is to validate that each unit of the software performs as designed. A unit is the smallest testable part of any software. See Unity Docs for more.
- Samuel Asher Rivello
- Over 20 years XP with game development (2020)
- Over 8 years XP with Unity (2020)
- Twitter - @srivello
- Resume & Portfolio - SamuelAsherRivello.com
- Git - Github.com/SamuelAsherRivello
- LinkedIn - Linkedin.com/in/SamuelAsherRivello <--- Say Hello! :)