• Online, Self-Paced
Course Description

Defensive programming is a methodology for writing code that is not prone to present or future errors potentially caused by unexpected user inputs or actions. In this course, you will explore the fundamentals of defensive programming for JavaScript and HTML5. This includes defensive techniques for HTML5 and JavaScript, as well as using inspections and testing, input validation, how to properly use variables and statements in JavaScript and HTML5. Lastly, you'll explore best practices for working with errors in HTML5 and JavaScript.

Learning Objectives

Introduction to Defensive Programming

  • start the course
  • describe the potential risks faced by software applications
  • identify the key reasons why risks are a recurring issue
  • recognize the key features of defensive coding
  • list some key approaches to preventing problems during the planning stage

Defensive Programming Techniques

  • recognize the correct way to use, or not use, the escape function
  • identify the key features of a strong Cross-Origin Resource Sharing Policy
  • use event handlers to account for and prevent untrusted data
  • utilize secure Web storage in JavaScript and HTML5
  • utilize secure web messaging in JavaScript and HTML5

Inspections and Testing for JavaScript and HTML5

  • identify the key features and benefits of testing
  • describe the benefits of testing your code for multiple browsers
  • recognize how to write testable code in JavaScript and HTML5
  • recognize how to perform tests using Visual Studio for JavaScript and HTML5

Defendable Code in JavaScript and HTML5

  • create examples of defensible methods in JavaScript and HTML5
  • identify the techniques for applying defensive techniques for method parameters and return values in JavaScript and HTML5 methods
  • recognize how to implement variable declarations for defendable code
  • identify how to use null values in creating defendable code
  • identify how to use if and switch statements in creating defendable code

Working with Errors in JavaScript and HTML5

  • identify error-handling techniques to promote defensive coding
  • demonstrate how to use exceptions to handle errors
  • create a JavaScript and HTML5 application that incorporates error codes and messages into its error handling
  • recognize how to use error processing and global objects
  • identify how to handle errors locally in JavaScript and HTML5 code
  • recognize how to anticipate potential errors in JavaScript and HTML5 code

Practice: Creating Defensible Code

  • use defensive coding techniques to create clean testable methods

Framework Connections