Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] using rusage



On 2008-06-23 08:04 +0900 (Mon), Josh Glover wrote:

> 2008/6/22 Curt Sampson <cjs@example.com>:
> 
> > For any software you're modifying, you essentially pay a maintenance
> > charge on every single line of code, every month.
> 
> Of course. But this is never a good reason to not program defensively.

Sure it is. You can go overboard with defensive code as much as with
anything else. Perhaps you really meant, "defensively within reason,"
for example, by not doing a readback and compare of every block you
write to the disk, in which case we would be in agreement that you need
to strike a balance.

You might also have a look at Erlang, where it's common practice not to
bother with error-checking code, and "let it fail" is the usual mode of
operation.

> In C, you just have to accept that you are going to need some guard
> code. You should certainly factor that guard code well; macros can be
> your friend here.

Yup.

> I find that any maintenance charge that defensive programming may
> introduce is less than that of debugging a catastrophic failure that
> lost data because "malloc() can never fail".

Right. That is a cost-benefit decision where in most cases I would
agree with you. The difference is that I looked at it explicitly from a
cost-benefit point of view, and recognised that that's a trade-off I'm
making.

cjs
-- 
Curt Sampson       <cjs@example.com>        +81 90 7737 2974   
Mobile sites and software consulting: http://www.starling-software.com


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links