Book review: Algorithms & Data Structures with Swift by Wayne Bishop

swift_book_small

Up until this point any Swift book I have read has always come as a result of an immediate need to learn something, whether it is to address a specific problem or task I am working on in an app, or the continued improvement of my Swift knowledge. With this book, Algorithms & Data Structures with Swift, by Wayne Bishop, USD 14.95 – 24.95 depending on which edition you purchase, I read it purely because it seemed interesting, and without any real application for what I was learning. To my surprise it was actually relevant to a few projects and problems I was tackling and also illustrated just how pervasive algorithms have become in our world today.

The book is actually accessible to a larger audience of people than I first suspected. If you are experienced with algorithms but new to Swift you will probably be fine. Likewise if you have an intermediate level knowledge of Swift but are new to algorithms your probably going to be alright. But, even if you are still a newcomer in both respects, but are motivated and know that algorithms are going to play heavily in your development endeavours than this could serve as an accessible, lightweight introduction to the topic. The book is more on the theoretical side so if what you are looking for is a collection of tutorials and a DIY, build it yourself style book then this might not be the right choice for you.

What the book is about

Algorithms & Data Structures has a total of 17 different sections. I won’t list them all out but some of the topics include Recursion, Closures, Sorting, Linked Lists, Depth-First Search, and Tries. Perhaps in part because the book is based on a collection of essays Wayne has posted over time to his site waynebishop.com each section is basically independent of the other so if you find yourself needing to jump right ahead to learn about Stacks & Queues you can do so. That said there is also value in reading from start to finish, as many of the sections do call back to what was taught in previous ones.

Not only does the book discuss code, which is the primary focus, but also gets into the math and logic of algorithms. These are not topics that lend themselves to wildly colourful prose. As such the book does have a very methodical, and clinical writing style to it. For the most part this is fine as concepts as explained clearly. However, if there was one thing I would say was missing it would have been putting some of these algorithms into a real world, programming context. The theory is interesting, but seeing direct applications of the concepts would be really beneficial to those people who need to see the concepts in action to really get the full understanding of them.

There is a print copy of the book available, as well as E-Pub and PDF versions. I have only seen the E-Pub version but I would imagine the layout would be much the same between the three versions. Overall it is a good looking book. The fonts used are quite readable, the code blocks are in colour, and there are lots of colour diagrams and pictures that help explain the concepts being discussed. The spacing feels a bit to big at times and compressing it a bit more would create a better presentation and improve readability. But those are small points and not anything that is negative impact on the book.

Algorithms & Data Structures is updated for Swift 2.2 so it is current as of today (June 9th to be exact). I did not see any indication as to whether the book will be updated for Swift 3.0. Because it is teaching concepts versus being a practical, DIY style book this will still be a relevant resource for a little while even if it doesn’t get updated right away after the 3.0 release, or if it doesn’t get updated at all.

How effective was the book

This is not a mind-bending university text book on algorithms and data structures. It is an accessible, approachable, introduction to the subject. I was able to read through this book on first sitting and have at least a partial understanding of each of the topics being discussed, and in some cases completely understand what was being taught. Everything was easy to follow along with and the illustrations were certainly helpful in conveying many of the concepts.

With all the source code being available on Github it also made it easy to take a look at full examples and play around with them to get a better understanding of how it all worked. That said this seems like a topic that would excel in the Playgrounds environment, especially at this introductory level and having that level of interactivity would really allow for some great learning opportunities. Algorithms & Data Structures is not long, so it is something you can tackle on a weekend.

The end result was that I know have a much better understanding of what role algorithms and data structures play in programming, some basics about them, and have a solid starting point for when I want to start exploring the subject more. The book also had the consequence of actually starting to get me to think how I could use algorithms in my own work. This is a deep, very complex subject, so it is not something I will jump into right away, but that consideration and thought is there now as I work on various applications and projects.

TL;DR

For the price of the book, and the time investment required, Algorithms & Data Structures is a good choice if you just want a basic understanding of the topic to round out your own knowledge, or if you want an accessible introduction before doing a deep dive into the subject. It is relatively easy to read and follow along with, and the break down of the topics into their own, largely, independent sections is nice if you need to use it as a reference.

But this also feels like a book that could be much more than it is. If some of the topics applied the concepts to real world use cases via tutorials or case studies, that one element alone would give it a lot more value. An expanded edition of this book that went to the next level with some of the existing concepts, or introduced a few new ones, could make this is a really valuable resource for Swift developers. Even so, as a quick and simple introductions to algorithms and data structures with Swift it serves its purpose well.

You can find Wayne Bishop on Twitter @waynebishop who also has a weekly mailing list you can sign up for. As always you can find myself on Twitter @third_beach and if you just want to follow updates for Manitoba.ninja you can follow @manitobaninja for just that.