Click here to Skip to main content
15,884,849 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Wordle Hurdle Pin
Phil J Pearson11-May-22 1:54
Phil J Pearson11-May-22 1:54 
GeneralRAD Basic Pin
TNCaver10-May-22 4:08
TNCaver10-May-22 4:08 
GeneralRe: RAD Basic Pin
OriginalGriff10-May-22 4:22
mveOriginalGriff10-May-22 4:22 
GeneralRe: RAD Basic Pin
TNCaver10-May-22 5:34
TNCaver10-May-22 5:34 
GeneralRe: RAD Basic Pin
OriginalGriff10-May-22 5:49
mveOriginalGriff10-May-22 5:49 
GeneralRe: RAD Basic Pin
obermd10-May-22 9:14
obermd10-May-22 9:14 
GeneralRe: RAD Basic Pin
TNCaver11-May-22 3:05
TNCaver11-May-22 3:05 
GeneralRe: RAD Basic Pin
trønderen11-May-22 12:26
trønderen11-May-22 12:26 
I have several times written code that was greatly simplified by explicitly ignoring errors after 'optional' operations.

A trivial example: If a personal user profile is available, use it to initialize the environment. If it is not, it really doesn't matter why not (in some environments, it might matter, but not in my cases). Otherwise, if an installation default profile is available, use that. If not, ignore the reason why it is not available, and use a hardcoded default profile. The application comes up running; that's the important thing for the user. Failing startup with a complex explanation that a user won't understand anyway is far less satisfactory.

For a first-time user, there will be no user profile; it is created from the first or second fallback. Defining an installation default profile is optional (and for a PC with a single user, it doesn't make sense), and setting it up requires far more understanding than from a first time user.

The #1 reason why the two first steps may fail is "It hasn't been created yet". I have not yet experience any other reason that a first time user would be able to fix even if the error message was displayed.

When the user exits the application, the personal profile is saved. Now, thorough checks are made. If there are conditions making that impossible, it will probably reveal the reason why the startup reading of the profile (which should have been there - the user is a returning one) failed. This happens very rarely, and doesn't bother the first time user. I have never experienced any case where reading a profile would fail but writing would succeed for any other reason than that it doesn't exist and will be created. So any other problem will be detected - without stopping the user from doing his work (although under a default profile).

You might argue: But for your own purposes, you should log the problem, even if you don't display the error to the user. That log would, in 99,9% of all cases, tell me: Reading user profile failed because this is a first-time user. Reading installation default profile failed because no installation default profile has been created. Well, I know that! I don't need a log file to tell me! For other failure reasons, the error report from saving the user profile will be good enough.

This reading of a user profile is one of three or four cases of "See if you can do the operation. If you cannot, it isn't a big deal - maybe even expected - so don't bother the user with it". Another case that comes to mind: At startup, looking for a saved list of uncompleted tasks for this user: If a task list is found, it is presented. If none is found, for whatever reason, it is not presented. If the user expected a task list and sees none, the documentation tells of possible reasons. The normal case is of course that there are no unfinished tasks, and failures to read the task list is not of interest to anyone.

I do not feel that I am doing a programming crime when I program in this style. (But then, I am also very fond of explanatory comments, so I always explain in the code why all errors are ignored.)
GeneralRe: RAD Basic Pin
Slacker00710-May-22 6:28
professionalSlacker00710-May-22 6:28 
GeneralRe: RAD Basic Pin
obermd10-May-22 9:13
obermd10-May-22 9:13 
GeneralRe: RAD Basic Pin
Dave Kreskowiak10-May-22 6:00
mveDave Kreskowiak10-May-22 6:00 
GeneralRe: RAD Basic Pin
obermd10-May-22 9:15
obermd10-May-22 9:15 
GeneralRe: RAD Basic Pin
Roland M Smith10-May-22 9:21
Roland M Smith10-May-22 9:21 
GeneralRe: RAD Basic Pin
Mycroft Holmes10-May-22 12:32
professionalMycroft Holmes10-May-22 12:32 
GeneralRe: RAD Basic Pin
jeron110-May-22 12:39
jeron110-May-22 12:39 
GeneralRe: RAD Basic Pin
Gary R. Wheeler10-May-22 14:22
Gary R. Wheeler10-May-22 14:22 
GeneralRe: RAD Basic Pin
TNCaver11-May-22 3:02
TNCaver11-May-22 3:02 
GeneralRe: RAD Basic Pin
kmoorevs11-May-22 4:05
kmoorevs11-May-22 4:05 
GeneralRe: RAD Basic Pin
TNCaver11-May-22 11:10
TNCaver11-May-22 11:10 
GeneralCCC 10-05-2022 Pin
pkfox9-May-22 21:36
professionalpkfox9-May-22 21:36 
GeneralRe: CCC 10-05-2022 Pin
OriginalGriff9-May-22 21:56
mveOriginalGriff9-May-22 21:56 
GeneralRe: CCC 10-05-2022 Pin
pkfox9-May-22 22:16
professionalpkfox9-May-22 22:16 
GeneralRe: CCC 10-05-2022 Pin
Kornfeld Eliyahu Peter9-May-22 22:01
professionalKornfeld Eliyahu Peter9-May-22 22:01 
GeneralRe: CCC 10-05-2022 Pin
OriginalGriff9-May-22 22:16
mveOriginalGriff9-May-22 22:16 
GeneralRe: CCC 10-05-2022 Pin
Vivi Chellappa9-May-22 23:30
professionalVivi Chellappa9-May-22 23:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.