Years ago I read a great book about design patterns: Head First Design Patterns. The book is pretty good and definitely deserves a few words. I’ll keep this article short and sweet.
I could go into details about what design patterns are, but I’ll leave the reading to you 🙂 Let’s just say, they’re standard solutions to known software problems. All design patterns have the same goal, managing complexity.
You probably read a book in the ‘Head First’ series, if you haven’t, they’re actually really fun to read. Every book in the series uses a metacognitive approach to learning. They’re trying to convey the books content using text, funny images, games… It’s a different kind of a book, and it’s really fun and refreshing. I love reading ‘Head First’ series.
Head First Design Patterns is probably the most useful book you can read from the series. Generally, design patterns are language and platform agnostic, so the knowledge you gain from this book can be applied anywhere. They use Java for their examples but it shouldn’t be a problem for you to convert the examples to swift.
In the original ‘Gang of Four‘ book there are many design patterns, but in this book you’ll only see a subset of them. Which is totally fine, because they cover the most popular ones. You might find out that you’ve been using some of the patterns from the book without even realising.
Some of the patterns that you might end up using in your swift project are: Strategy, Observer, Factory, Singleton, Adapter, Facade, State… They even cover the MVC patterns, which is the recommended pattern to use on iOS (let’s not get religious here, it is recommended by Apple 🙂 )
After every chapter of the book you’ll see some puzzles and challenges. Definitely do those, because it will solidify your understanding of the topic covered in that chapter. As you’re reading the book, you might encounter a challenge or two, do those as well. The authors were very careful about when/where to place those. They know what they’re doing. The idea behind those challenges is to involve you and make you think about the content you just read. And I have to say, it works beautifully.
All in all, this is a really good book, that definitely deserves your attention. It’s one of the evergreen books that you can keep on your shelf and use as a reference while coding. It certainly helped me a lot in my career. The original ‘Design Patterns‘ by the gang of four is still ‘The Book’ on design patterns, but it’s a bit dry. This book is a bit more fun to read and it will bring you up to speed fairly quickly. Definitely worth a read.
As promised, short and sweet… And, as usual, have a nice day 🙂