• Online, Self-Paced
Course Description

Defensive Programming in Android uses coding practices and techniques to create apps that are reliable and resilient. This course will teach you some language-specific Java techniques that promote defensive programming when creating Android apps, as well as how to access the network in Android apps in a way that does not affect user experience.

Learning Objectives

Java Defensive Programming Techniques

  • start the course
  • initialize instances of classes safely
  • check for the presence of null to avoid errors
  • design setters to avoid potential errors
  • recognize how to compare two objects in Java avoiding potential errors
  • work safely with the Java switch and case statements
  • use atomic and nonatomic operations in threaded applications
  • use final properties to minimize potential for errors
  • recognize when to use mutable and immutable classes

Java Enums

  • implement a basic enum in Java
  • use enums to reduce the possibility of unexpected input
  • implement an enum with a constructor and recognize the rules for enum constructors
  • implement an interface in an enum
  • create an enum with abstract methods

Packaging Java Code

  • use packages and classes to implement proper encapsulation
  • import packages in Java Android apps
  • use different scopes to implement defensive programming
  • create APKs to run on Android devices
  • create jars for exporting Java code between apps

Network Access

  • recognize the importance of maintaining a good user experience while accessing the network
  • use AsyncTask to retrieve data asynchronously and preserve user experience
  • use progress reporting to enhance user experience
  • cache retrieved data to enhance user experience
  • transfer large files in the background
  • check network connectivity status in Android apps
  • sanitize data transferred across the network

Practice: Network Access

  • create an Android app to access the network asynchronously

Framework Connections