Defensive Programming

Programmers tend to be optimistic because when they write code, they assume that it will work correctly. However, it’s often better to be more pessimistic when it comes to programming. Instead of assuming your code will work the first time, it’s safer to assume your code won’t work at all. This forces you to be extra careful when writing Swift code to make sure it does exactly what you want and doesn’t do anything unexpected.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic €32.70 /Month

Buy Now

Price includes VAT (France)

eBook EUR 49.99 Price includes VAT (France)

Softcover Book EUR 63.29 Price includes VAT (France)

Tax calculation will be finalised at checkout

Purchases are for personal use only