Code - Do you handle all possible scenarios?

Updated by Brady Stroud [SSW] 1 year ago. See history

123

When developers build software, they naturally become experts in using the software. This is problematic because with this expertise, they will tend to focus on the happy path of the user. However, it is important to consider all possible scenarios that could occur. This includes edge cases, such as invalid inputs, unexpected user behavior, and system failures. By handling all possible scenarios, you can ensure that your code is robust and reliable. Here are some tips to help you spot where you need to handle more scenarios:

  • Think of potential "unhappy paths"
    • Ask yourself "what could the user do wrong here?" (e.g. What if the user enters an invalid email address?)
    • Assume your users are doing something for the first time
  • Get a test please on all your code
Image

❌ Figure: Bad example - Users can enter invalid emails

Image

✅ Figure: Good example - Code checks the email is valid

acknowledgements
related rules