Summary

We have covered a lot of very large design concepts in a short period of time. We have looked at a number of specific design patterns, that help reduce the complexity of our code by reducing inter-object dependencies, commonly referred to as low coupling, and increasing the simplicity in which those objects work together, otherwise referred to as high cohesion.

We learned that there are three types of design patterns that focus on fixing different types of problems. Behavioral patterns help objects communicate with each other better, structural patterns facilitate the breaking down of complex structures into smaller and simpler ones, and creational patterns help with the initialization of new objects.

We also looked at some very specific features of Swift and how they can help us achieve similar goals to the ones we achieve with design patterns. We saw how to use enumerations with associated values to reduce the complexity of our type system and represent state better; we used extensions to system types to reduce the amount of code we write, and we wrote more efficient and understandable code using lazy properties.

As I said in the beginning, design patterns is a huge topic and not something you will master quickly, if ever. Figuring out how to best use the feature of a specific language is also a huge topic. I strongly recommend you use this chapter as a reference when you start to develop larger software and want to find ways to make it less complex. I also strongly encourage you to research more patterns and try to implement them on your own. Each design pattern is another tool in your toolbox. The more tools you have and the more experienced you are with each of them, the better you will be able to choose the right tool for the right job. That is the art of programming.

Now we are ready for the next chapter, where we will take a step back into the past to look at Objective-C so that we can leverage the vast resources targeted at Objective-C that are still very relevant to us as Swift developers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset