Handling Edge Cases: Building Resilient Apps

Written by: Caleb Hatcher

Introduction

When building a mobile application, focusing on “happy path” use cases is easy—the ideal scenarios where most users smoothly complete their tasks. For instance, consider a weather app where a user enters a zip code and receives the weather forecast for that area. But what happens if the user loses an internet connection? Or if they’re using an older device? These scenarios, which deviate from the happy path, are called edge cases and can significantly impact user experience. At Shockoe, we know tackling edge cases isn’t glamorous, but it’s the difference between a good application and a great one.

What Are Edge Cases?

Edge cases are infrequent scenarios outside typical user interactions but can disrupt the app’s functionality or user experience. While they may affect a smaller subset of users, overlooking them can lead to frustration for those users, tarnishing your app’s reputation and usability.

 

Types of Edge Cases

  1. Device Compatibility
    • Device Fragmentation (Android): A wide range of hardware configurations, screen sizes, and OS versions. 
    • Older Devices: Outdated OSs or limited memory devices can struggle to handle modern app features.
  2. Network Issues
    • Intermittent Connectivity: Think of a user in or traveling through a remote area.
    • No Connection: Offline scenarios are more common than you’d expect. Whether users are on airplanes or conserving mobile data.
    • High Latency: Delays due to slow network speeds can frustrate users if mishandled.
  3. Accessibility Options
    • Screen Readers: Ensuring compatibility with voice guidance for visually impaired users.
    • Gestures: Supporting custom gestures or alternative navigation methods.
    • Text Size Adjustments: Users can adjust their font sizes in their OS’s settings. If this isn’t accounted for, layouts can break.
  4. User Input
    • Special Characters: Emojis, symbols, or unusual formatting.
    • Unexpected Input Sizes: Handling very large or empty inputs. Expect users to input large strings or even leave them blank.
  5. Data Issues
    • API Failures: Server outages or unresponsive endpoints can cause frustrating user interactions.
    • Null Responses: Missing data or unexpected values can lead to crashes or broken features.
    • Schema Changes: Adjustments to API structure can break previously working versions of the application.

 

Handling Edge Cases

  1. Device Compatibility
    • Test your app across various devices, including older models and screen sizes. Android devices come in different screen sizes, including newer formats like foldable displays.
    • Use tools like BrowserStack, AWS Device Farm, or in-house testing labs to simulate different hardware and software environments.
    • Don’t forget to test on older hardware or devices running outdated OS versions. Not everyone has the latest device!
  2. Network Handling
    • Implement retry mechanisms for failed requests with increasing intervals between retries to avoid overwhelming the server.
    • Use caching to store data locally, ensuring basic functionality even when offline. Tools like SQLite, Realm, and Async Storage can facilitate this. This can be a lifesaver. Bonus points if you notify the user they are seeing cached data and how old the date is.
    • Provide clear, actionable error messages. For example, notify users when they are offline and provide options like “Retry” or “Go Offline”. A generic “Something went wrong” message won’t cut it.
  3. Data Issues and Error Handling
    • Versioning APIs ensures backward compatibility. At Shockoe, we have found that this allows older app versions to function correctly as you update your backend services.
    • Validate API responses and handle null or unexpected data gracefully to prevent crashes. A simple mistake in the backend shouldn’t break the front end. 
    • Display user-friendly error messages that help users understand and resolve issues where possible.
  4. Testing for Edge Cases
    • Throttling Network Speeds: Use developer tools to simulate slow or unstable connections. Simulating a 3G connection can teach you a lot about your application.
    • Automated Testing: Leverage tools like Espresso, Appium, or Maestro to test edge cases systematically. 
    • Stress Testing: Push your app to its limits with heavy traffic or large datasets to uncover weak points.
    • User Testing: Before full deployment, use beta groups or phased rollouts to gather feedback from a diverse group of real users.

 

Best Practices for Handling Edge Cases

  1. Plan for Failure
    • Assume that things will go wrong, and design your app to handle those failures gracefully. Keep your app functional even in less-than-ideal conditions.
    • Use defensive programming techniques to minimize crashes and unexpected behavior.
  2. Monitor and Learn
    • Monitoring tools like Firebase Crashlytics or Sentry can be used to track crashes and anomalies before they snowball. It is always better to find out issues before a user has to report them. 
    • Analyze logs to identify patterns and proactively address issues.
  3. Communicate Clearly
    • Notify users when something isn’t working and provide actionable options (e.g., “Retry” or “Contact Support”). Users appreciate transparency. If something isn’t working, tell them why.
  4. Iterate Based on Feedback
    • Continuously gather feedback from users and logs to improve handling of edge cases.
    • Regularly revisit your assumptions as new devices, OS updates, and user behaviors emerge.

 

Conclusion

At Shockoe, we understand the importance of addressing edge cases to deliver exceptional mobile app experiences. Creating resilient apps goes beyond just the happy path. It’s about anticipating real-world challenges and designing solutions that satisfy users no matter the scenario. Our team is dedicated to building robust, user-friendly apps that are prepared for the unexpected. By focusing on proper error handling, user-centric design, and thorough testing, we ensure our applications provide impact and reliability to all users.

Do you have a strategy for edge cases that has worked well for you?

Want to learn about how the assessment is scored?

This survey is designed to help heritage and iconic brand leaders objectively assess their current level of digital maturity and readiness for developing mobile apps and immersive experiences.