What is robust programming?

Cing Sian Dal
1 min readMar 26, 2021

A robust program is one that can handle errors and other unexpected conditions in some reasonable way. This means that the program must anticipate possible errors and respond to them if they occur.

ဆိုလိုတာက Robust program တစ်ခုသည် အကျိုးအကြောင်း စီလျော်စွာ error handling, exception handling လုပ်ပေးနိုင်ရမယ်။

Then, Why should a subroutine throw an exception when it encounters an error? Why not just terminate the program?

Terminating the program is too drastic, and this tactic certainly doesn’t lead to robust programs! It’s likely that the subroutine doesn’t know what to do with the error, but that doesn’t mean that it should abort the whole program. When the subroutine throws an exception, the subroutine is terminated, but the program that called the subroutine still has a chance to catch the exception and handle it. In effect, the subroutine is saying “Alright, I’m giving up. Let’s hope someone else can deal with the problem.”

ဆိုလိုတာက program တစ်ခုမှာ ဘာကြောင့် ဖြစ်သွားလဲဆိုတာကို မဖော်ပြပဲ program ပိတ်ချလိုက်တာ။ ဆိုတော့ debugging လုပ်တဲ့အခါမှာ ဘာကြောင့် ဖြစ်သွားမှန်း မသိတဲ့အတွက် ဘာနေရာမှာ ဘာပြင်ရမှန်းကို မသိရတော့တဲ့ ပြဿနာ ဖြစ်လာနိုင်ပါတယ်။

References:

--

--

Cing Sian Dal

Don’t follow me. I wrote junks here. Follow me on Twitter instead.