Skip to content

Latest commit

 

History

History
92 lines (51 loc) · 2.24 KB

File metadata and controls

92 lines (51 loc) · 2.24 KB

Code Smell 97 - Error Messages Without Empathy

Code Smell 97 - Error Messages Without Empathy

We should take special care with error descriptions for the users (and ourselves).

TL;DR: Use meaningful descriptions and suggest corrective actions.

Problems

  • The Least Surprise Principle

Solutions

  1. Use declarative error messages

  2. Show clear exit actions

Context

Programmers are seldom UX experts.

We also underestimate the fact we can be on both sides of the counter.

Sample Code

Wrong

alert("Cancel the appointment?", "Yes", "No");

// No consequences
// The options are not clear

Right

alert("Cancel the appointment? \n" +
      "You will lose all the history", 
      "Cancel Appointment", 
      "Keep Editing");

// The consequences are clear
// The choice options have context

Detection

[X] Manual

We need to read all exception messages in code reviews.

Tags

  • Exceptions

  • UX

Level

[X] Beginner

Conclusion

We need to think in our end users when raising exception or showing messages.

Relations

Code Smell 139 - Business Code in the User Interface

Credits

Photo by visuals on Unsplash


While it is a known fact that programmers never make mistakes, it is still a good idea to humor the users by checking for errors at critical points in your program.

Robert D. Schneider

Software Engineering Great Quotes


This article is part of the CodeSmell Series.

How to Find the Stinky Parts of your Code