Thứ Năm, 20 tháng 5, 2004


Return-codes vs. Exceptions, Part 228



Measures for Excellence: Reliable Software on Time, Within Budget (Yourdon Press Computing Series)Pete's blog had a good critique of my last blog entry on return-codes versus exceptions. The examples were quite accurate, though...



I guess I'm beating a horse that's not only dead, but is already sleeping with the fishes (and Big Pussy) in the Hudson river... but,



I had comments inserted (the "// log" lines) where logging and instrumentation would go... the idea being that we could reconstruct a series of faults from the lowest level as we audited or unit-tested the code. I'm not sure how we would do that in Pete's examples - feedback?



The idea is that we end up with a log like this:



11:01:00 TableDebits.Lock failed for table 'ade1201' (layer 3)

11:01:00 Table 'ade1201' update failed - locking fault - rolled back (layer 2)

11:01:00 "Transfer failed, please try again later" (layer 1, the UI)




Again, this is a highly simplified example, but hopefully that indicates the kind of detailed logging/instrumentation I'd like to see at every step of the way.

Không có nhận xét nào:

Đăng nhận xét