Book Image

Swift 3 Protocol-Oriented Programming - Second Edition

By : Jon Hoffman
Book Image

Swift 3 Protocol-Oriented Programming - Second Edition

By: Jon Hoffman

Overview of this book

<p>One of the most important additions to the new features and capabilities of the Swift programming language was an overhaul of Protocols. Protocol-oriented programming and first class value semantics have now become two incredibly powerful concepts at the heart of Swift’s design.</p> <p>This book will help you understand the difference between object-oriented programming and protocol-oriented programming. It will demonstrate how to work with protocol-oriented programming using real world use cases. You will gain solid knowledge of the different types that can be used in Swift and the differences between value and reference types. You will be taught how to utilize the advanced features of protocol-oriented programming to boost the performance of your applications.</p> <p>By the end of the book, you will have a thorough understanding of protocol-oriented programming and how to utilize it to build powerful, practical applications.</p>
Table of Contents (14 chapters)
Swift 3 Protocol-Oriented Programming - Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Data access layer


Most serious applications need to persist some amount of data. This data could be transactional data, user preferences, or the current state of the application. There are many ways that we can persist data in our applications and figuring out the appropriate way to persist it can be one of the most critical decisions that an architect needs to make.

As an architect, we should separate the actual data storage from our business logic. This will allow us, in the future, to change how our data is persisted without having to change our business logic. This is called a data access layer.

It is important when designing an application, to design a good data access layer. Having a good data access layer will make our code much easier to maintain as requirements change. As an example of this, let's say that we choose to persist our data in an XML formatted file and then we embed the code to access this file in multiple parts of our code. In the future, if we decided to switch to a...