Defensive Programming in Java: Fundamentals

Java developers seeking an introductory guide to developing efficient, secure, Java applications that are defendable against a variety of issues

Prerequisite
None

Expected Duration
180 minutes

Description
Defensive programming is an approach to programming that attempts to ensure that software still functions under adverse or unforeseen circumstances. In this course, you will explore the fundamentals of defensive programming in Java including how to use assertions and annotation, and how to use classes, types, methods, and program flow control securely. You will also learn how to handle exceptions correctly, how to manage resources, and how to terminate a program securely.

Objective

Introduction to Defensive Programming

  • start the course
  • recognize the key features of defensive coding in Java

Using Assertions and Annotations

  • use assertions in your Java programming code
  • use annotations in Java programming code

Methods

  • create examples of defensible methods in Java
  • identify and apply defensive techniques for handling untrusted method parameters
  • apply secure checks on method return values

Types and Operations

  • identify issues with conversions to narrower types in Java and identify issues with promotions such as long to double
  • identify issues with floating point values
  • recognize what integer overflow is and how to prevent it
  • identify issues with arithmetic operations in Java programs
  • identify issues with forming strings containing partial characters from variable-width encodings
  • identify issues with encoding noncharacter data as a string
  • identify issues with using strings to compare locale-dependent data
  • identify how to use null values in creating defendable code

Classes and Objects

  • identify how to work with classes to create defendable code
  • identify how to work defensively with constructors in Java
  • identify issues with mutability in Java classes
  • identify how to work defensively with serialization and deserialization in Java
  • identify the difference between abstract object and reference equality in Java programs

Program Flow Control and Collections

  • identify how to use conditional expressions when coding defensively
  • identify how to avoid assignments in conditional expression for defensive programming in Java
  • identify how to distinguish and use bitwise and logical operators in conditional expressions
  • use best practices in working with enhanced for poop in Java programs
  • identify how to use collections safely in Java programs

Errors, Resources, and Terminations

  • demonstrate how to use exceptions appropriately in Java to handle errors
  • identify how denial-of-service or DoS attacks can occur
  • identify how to manage resources safely in Java
  • identify how to correctly terminate Java programs

Practice: Creating Defensible Code

  • use defensive programming techniques in Java programs

MONTHLY SUBSCRIPTION

$129/month
 

ANNUAL SUBSCRIPTION

$1295/year

Multi-license discounts available for Annual and Monthly subscriptions.