There was a boy and his mother. One day, the boy came back home with blood on his forehead. Yeah, he hurt himself on his forehead.
The mother asked “ what’s happened, my dear?” “I bend my head on the door when I go potty.” answered the boy.
“what? silly boy. you should open the door and then going through it. why you bend your head on it?”
“ why? the door supposed to be opened all the time!” augured the boy.
“My dear boy, this is what you want to do next time.” said the mother with smile, “no matter what is supposed to be, you check it to see if the door is open before you going through it..”
“thank you mom, I will do as you say.” replied the boy.
The door supposed to be open but it is not. that is the root cause of the boy getting hurt. but the month did not address the root cause , rather make her son smarter so that he won’t get hurt.
The next day, the boy came back with his pants wet. The mother asked “my son, what happened, did you go the bath room to pee?” . “No, the door is closed.” replayed the boy sadly.
“My dear boy, this is what you want to do,” said the mother with simile. “ when the door is closed, try to open it.”
The root cause is still the same, the door is not open and it supposed to be. but the mother did not address the root cause of the problem, rather make her son smarter to open the door when he need to go potty
The next day, the boy came back with his pants wet again. The mother asked “my son, what happened, did you try to open the door of the bathroom “. “I did, but the door was locked.” replayed the boy sadly.
“My dear boy, this is what you want to do,” said the mother with simile. “ when the door is locked, report you teacher and seek her help..”. “thank you, Mother, I will do as you said.
From the surface, the root cause is the same, as the boy was told to open the door when it is not open, so the boy try to open the door, hence he found the door not only closed but also locked. should he did not try to open the door, there would be no way for him to know for sure, the door is locked. all he could say is “the door may be locked, maybe not. I do not know” with the newly developed intelligence, he managed to identify a more precised root cause. but the boy was not taught on how to handle the root case “door is locked”. His mother did not call to the childcare center to ask them to fix the root cause. instead, she taught her son another smart thing to do: when you are not able to handle it, report to someone who can.
The next day and the days after, the boy came back from the childcare center without incident.
From the beginning to the end, the mother did not do anything to directly address the root cause. From “door is not open” to “door is locked” all she was doing was teaching her son to be more intelligent in handling the environment. When the precise and accurate information was provided to the relevant party, The root cause will be addressed or at least, the boy would not get himself hurt or get his pants wet. Even if one day, the door was really locked and the key is nowhere to be found, the teach should and will find some other ways to help the boy to pee. if not, the mother will really have a complain to made…
Now, coming back to our programming work, we, as programmer, like the mother, the program we write is like the boy. The program will do as we told it to do, Nothing more and nothing less. Based on the logged unhandled exception. instead of immediately doing something with the goal of addressing the root cause. we tell our program to be smarter. when we see exception of “Object reference not set to an instance of an object.” it is like the mother see blood in her son’s forehead.
When you see exception of “Enum value '0' is invalid for type 'CustomerType' and cannot be serialized.” it is like the mother see the boy with his pants wet… You do not want to see these types of exceptions logged as inner exception while the outer exception is
The information entered does not match the information on file. Please call the Department of XYZ at (800) HLP-DESK (457-3375) for assistance or Please visit a ABC office for assistance.
As the development resource (like the mother). it is our job to make the program we write more comprehensive and more robust in handling various situations in the running environment. When we do that, the root cause will be solved by the respective party, or at least we won’t get blamed for the problem caused by the root cause.
check, mitigate and report are the 3 steps the mother taught her son. These are also the same strategy we could employee when see some unhandled exceptions in the system..
No comments:
Post a Comment