By using listi.net you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

listi.net

 


Defensive Coding

Defensive coding is a technique to prevent unexpected issues from happening
  • Detect an infinite loop
  • Add a doevents to a loop
  • Check that you're on the sheet you expect to be on
  • Ask the user how to proceed
  • Stop if unexpected condition
  • Error handling
  • Logging
  • in a sub if you go to a sheet, go back to where you came from
  • Make sure the data you got from external source is correct and in the right format
  • Proactively look for code issues. ex. end date is before start date
  • Make sure numbers and dates aren't strings
  • Stop, Resume Next, Resume, error handling
  • Ask user to verify what you're doing before proceeding
  • Check what sheet you're on before doing an action

  • blog comments powered by Disqus