Robustness of a Program

◀ Run-time efficiency of a Program▶ Understand What the Program Needs to do
Amazon Robustness describes how reliable your program is, especially under extreme conditions such as extreme workload and bad or unpredictable user inputs. Does your program crash on certain user inputs or under big stress? Does your program act strange given some specific control flow? Is your program fault tolerant?

Ideally, your program should never crash no matter what the user inputs. Even if the user enters invalid data, your program should handle it properly. The worse thing it can do is terminate the program gracefully.

At times this is hard to achieve; for instance, you expect the user to give a file according to a specific format. If file is completely out of accordance with that format, how do you process that file? One way to do this is to check the validity of the file before you process it; if the file is improperly formatted, output an error message and terminate the program. Another way is to do the checking while processing it.


To sum up, it is dismaying for a user who accidentally enters the wrong inputs to see the program crash immediately. Whenever you write a program, think about how well your program reacts to the most deranged psychotic in the world.
Does your program crash under heavy stress? If your program creates a thread for every request infinitely then it could run out of memory.

A classic example is a web server. A web server serves HTTP requests from clients. If ten thousand clients make an HTTP request to the server, the server needs to handle the load gracefully.

If you are writing a third party library package you’ll need to make sure the functions are robust and reliable so that when people use your library they won’t get incorrect results or even make their program crashing.

A straightforward way to do so is check the arguments to make sure they are acceptable by your function. If they don’t return some error code or NULL depending on the nature of your function. Whatever you do state it clearly in the documentation.

Next we’ll look at what you should do to prepare yourself for a programming task!

◀ Run-time efficiency of a Program▶ Understand What the Program Needs to do

fShare
Questions? Let me know!