Welcome to this introduction post about the upcoming series where we will cover Design Patterns.
“Design patterns should not be applied indiscriminately. Often they achieve flexibility and variability by introducing additional levels of indirection, and that can complicate a design and/or cost you some performance. A design pattern should only be applied when the flexibility it affords is actually needed.”– Erich Gamma
Why this series?
I believe design patterns are very much depreciated nowadays. I don’t hear many people talking or writing about it, which makes me questioning.. 🤔
We all love to writing and talking about clean code and having a good architecture. But one of the best ways to achieve this is by applying design patterns.
Design patterns are used to make our projects flexible, scalable and removing repeatable code (aka DRY code).
I depreciated design patterns when I was a student. I felt like it was overcomplicating my projects and wasn’t worth applying. But once I started to see the use of it, I figured it wasn’t overcomplicating my projects but doing the opposite. It was simplifying my projects and making it reusable and scalable.
This allowed me to make even more games and add features much quicker than initially.
What do you need to know?
- Basic understanding of Programming
- Basic understanding of OOP
- Know how to copy paste 😉
We’ll begin with two fairly simple patterns.
- Façade Pattern
- Singleton Pattern
With these two patterns and a set of actions, we’ll build simple but fun guess game!
In the game there will be a sorcerer asking for food. When you give the sorcerer the correct type of food. He’ll reward you with a point. But when you’ll give him the wrong type of food, he’ll kill himself, resulting that we must start over again.
A very simple game concept, but great to demonstrate these first two design patterns. 🙌
In this series each episode will have all valuable resources listed at the end.
These are the main resources which helped me understanding design patterns to what I know today. I still often use these resources to refresh my brain when I need to apply a pattern I didn’t use yet or didn’t apply in a while.
Game Programming Patterns
Game Programming Patterns is a book written by Robert Nystrom with a great in depth explanation about design patterns and it’s use for game development.
You can buy his book or read it for free on:
Head first design patterns
Head first is one of my all time favourite book series. They explain everything in such a fun way which makes it really enjoyable to read!
Or buy here if you wish to have a hard copy
Thanks to Derek Banas I learned a lot about design patterns myself. But also use his videos to refresh my knowledge quite often too.
His series about design patterns is a great asset for this series.
Wikipedia is a great resource for design patterns. I sometimes scroll through the list to see if there is a pattern matching my needs for what I am working on.
Often there are patterns I didn’t know about, but were the perfect solution to my current implementation.
Refactoring Guru has a fantastic list and perfect explanations about lots of design patterns. It’s explained in multiple programming languages, so there is no excuses in not understanding how to implement it in your current projects. 😉
For me the best way of learning is to use it and experiment it. So, allow me to teach you and let you experiment too! 🙌
I hope you will enjoy this series and building games together with me!
Not only will I try to teach you how to use design patterns, but also some game development tips along the way!
If any questions, feel free to message me on Instagram @justinbieshaar or in comments below!
Also, if there are design patterns you wish to be covered or enjoy using, let me know, and I’ll cover it in this series!
Happy coding everyone! 👨💻