in reply to Re^2: HoA create from array using map, more efficient?
in thread HoA create from array using map, more efficient?
(disk corruption, interrupted network connection, ...).
Sorry, but that really is paranoia.
Firstly, if your network protocol & handling doesn't detect interrupted network connections long before you start running regex against the corrupted or truncated data that comes from it, then you are either using the wrong protocol, or skipping good practice on your handling.
As for disk corruption, -- which does happen -- if your data is important enough then you'll be using raided disks that will detect and correct errors (and flag the corrupted volume early and loudly).
Attempting to programming every statement to try and detect the possibility of hardware failure is a futile exercise that at best costs dear for no benefit, and at worst can be the cause of project cancellation.
Proof by reductio ad absurdum: If you are going down that route, then you would also have to check for the possibility of memory failure -- I had a 2GB ram module fail only a couple of weeks ago.
So what could you do? How can you be sure that when you read a value back from a variable that you get the same value that you stored? Perhaps you store every value in two different variables and then read them both and compare them. But what do you do if they are different? Is it the original value that was corrupted? Or the backup?
No way to tell, so now you have to store everything thrice and do a 3-way compare each time you use a variables value and go for the consensus. But what if it isn't the memory holding one of your three copies of the variable that gets corrupted, but the ram that holds the result of the comparison?
So now you need to have two separate routines that each do the 3-way compare to ensure that they use different memory locations for the result. But when one of the results is corrupted, you don't know which one is the good one, so now you need three routines doing the 3-way compare and then compare the three results. And you need to do this for every variable and every access to every variable.
Ah! But then the memory that holds the results of the comparisons of the results could be the ram location that has a drop out ...
Or, you could just use EEC ram chips!
There is an appropriate place and mechanism for detecting hardware corruption and failure. And "defensive programming" of every line of code is not that place or mechanism.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: HoA create from array using map, more efficient?
by hsinclai (Deacon) on Jun 18, 2011 at 20:13 UTC | |
by BrowserUk (Patriarch) on Jun 18, 2011 at 21:13 UTC | |
by graff (Chancellor) on Jun 20, 2011 at 00:05 UTC | |
|
Re^4: HoA create from array using map, more efficient?
by graff (Chancellor) on Jun 19, 2011 at 23:12 UTC | |
by BrowserUk (Patriarch) on Jun 19, 2011 at 23:49 UTC |