Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Defensive Programming In JavaScript

Defensive Programming In JavaScript

20 Tips for defensive code. My experience writing defensive front-end javaScript for Server Density, specifically:

* Why defensive code should matter to you
* Lessons in defensive failures.
* Why you should be ruthlessly pragmatic about bugs.
* JavaScript and defending against type errors
* How your code can be more defensive today.
* Takeaways for the sceptics.

byrichardpowell

May 17, 2014
Tweet

More Decks by byrichardpowell

Other Decks in Programming

Transcript

  1. “Defensive programming is … intended to ensure the continuing function

    of a piece of software under unforeseen circumstances. en.wikipedia.org/wiki/Defensive_programming
  2. 1. You want robust software 2. You want easy debugging

    3. You want to re-use code 4. You have an unpredictable environment 5. You have user generated data
  3. 1. How I became paranoid 2. Frank Underwood’s greatest compliment

    3. Why I respect types 4. How you can be more defensive 5. Takeaways for the sceptics
  4. A B

  5. A B