Member-only story

The Swiss Cheese Model: How Layers of Defense Improve Swift Code Resilience

Testing is important!

Steven Curtis
5 min readApr 23, 2023
Photo by Azzedine Rouichi on Unsplash

There’s a secret. Testing your Swift is a good thing in your App, and I’ll tell you why. However human systems are fallible and in steps The Swiss Cheese Model of accident causation where we should be aware of the holes in our layers of testing defenses.

The Swiss Cheese Model

In any organisation, defenses against failure are a series of imperfect barriers with “holes” that represent weaknesses in each layer. When a system failures these “holes” align temporarily so the issue passes through all of the holes in the layers leading to a failure.

The Testing Layers

Defensive programming

Defensive programming is an approach to writing code where potential issues are tackled proactively. Swift coders should avoid bad practice such as force unwrapping and use language and compiler features to create great code.

Input validation

--

--

No responses yet