Design patterns in Lua
Tip
Use design patterns to solve real-world problems, do not adapt your code to the problem.
Design patterns are common ways to solve problems that come up often in software development. They are like blueprints/guides you can adjust to fit specific challenges and common tasks in the code.
Lua is not an exception language, and all 22 classic design patterns can be implemented in Lua with the help of classes and object-oriented programming.
Usually there are three categories of design patterns:
- Creational patterns provide object creation mechanisms that increase the flexibility and reuse of existing code.
- Structural patterns explain how to assemble objects and classes into larger structures, while keeping these structures flexible and efficient.
- Behavioral patterns take care of effective communication and the assignment of responsibilities between objects.
Creational design patterns
Structural design patterns
Behavioral design patterns
- Chain of responsibility
- Command
- Iterator
- Mediator
- Memento
- Observer
- State
- Strategy
- Template method
- Visitor
References
Feedback
For feedback, please check the contacts section. Before writing, please specify where you came from and who you are. Sometimes spammers go insane. Thank you in advance for your understanding.