© Avi Tsadok 2020
A. TsadokPro iOS Testinghttps://doi.org/10.1007/978-1-4842-6382-2_6

6. Write Testable Code

Avi Tsadok1 
(1)
Tel Mond, Israel
 

Quality means doing it right even when no one is looking.

—Henry Ford

Introduction

We already know that testing your app is a crucial task to maintain high-quality code over time. But to do that, we need our tests to be simple and easy.

Testable code is a derivative of robust, modular architecture and clean, simple code. Although this chapter does not deal directly with testing, it’s a prerequisite to learn how to test your code, and in general, it’s a good chance to leverage your code quality.

In this chapter, you will learn
  • What is Clean Code, including terms like KISS, DRY, and YAGNI

  • What are Pure Functions

Get Pro iOS Testing: XCTest Framework for UI and Unit Testing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.