DrupalCon Dublin 2016: A Cautionary Tale for Defensive Programmers
Channel: Drupal Association
Date: 2016-09-28

As software developers, we know our software will fail; someone will use it in a way we did not anticipate, we will forget to properly check input, a process will time out, and we will make typos.

For these reasons, and many more, people spend time and efforts on reproducing problems, and finding and fixing root causes. If this hasn’t caused too much of a delay, there may even be time to make sure these problems never show up again.

It is inevitable. Or is it?

This talk will take you through the concept of defensive programming, with its many helpful tools like exceptions, assertions, typing, and validation. It will elaborate on several programming techniques you can leverage to tell calling code about your problems, and to handle the problems of the code you call yourself.

Defensive programming will help you write simpler and more maintainable software, that fails fast, early, and often. When problems do occur, they are reported in greater detail, making them easier to understand, and faster to fix. This limits the time spent fixing bugs, and lowers the chances of ‘random’ or obscure problems, making estimates more reliable.