+ 2
What the mean of robust
please help me to know
5 Antworten
+ 4
When I say 'I want to make this code more robust', It means to simplify and make nicer codes as well as making the code much more powerful and friendly to the IDE/Compiler.
For example :
if (x != null && y != null)
{
x.Afunction(y.TakeSomething);
}
becomes into :
if (x == null) return;
if (y == null) return;
x.Afunction(y.TakeSomething);
Aka that helps to prevent overlapping in the conditions and allows the code to get out of a certain block of area/code easily.
+ 1
mmmh why the downvote? someone disagree?
0
robust code will fail gracefully (eg report meaningful errors, rather than crashing) when unexpected events happen or invalid user input is entered.
0
also robust code is easy to read and maintain even by others.
- 1
Robust code is achieved by making sure any data from outside the code (user input, parameter values ) is valid before using it.
And/or using try/catch constructs to report errors gracefully when smthing goes wrong.