> -- Евгений Темиргалеев писал(а):
> Это охрана от логической ошибки. Когда программист думает, что предусмотрел все случаи, а на деле выходит не так.
Напомнило философское рассуждение авторов известного написанного на ББ прикладного пакета OpenBUGS о сложностях дебаггинга в сложных ОО-системах:Lunn, D., Spiegelhalter, D., Thomas, A. and Best, N. (2009) The BUGS project: Evolution, critique and future directions

> -- Цитата:
> One downside of object-orientation in systems as complex as BUGS is that it can make debuggingsomewhat difficult. In more traditional programming settings, there would typically be some kindof master program specifying a list of commands to be executed in sequence. A debugger canthen be implemented to step through each command in turn and provide current information onparameters of interest. In contrast, objects are generally designed only to make/respond to variousrequests of/from other objects—they have little or no concept of the order in which external eventsoccur. Consequently, an object-oriented program typically behaves as a complex chain-reactionand the path back to the source of any error may be extremely convoluted. This can make forindecipherable error messages, error messages that have nothing to do with the actual error, andimpenetrable ‘trap’ windows, all of which even the developers of the software sometimes struggleto understand. For example, an ‘undefined real result’ trap lists the sequence of ‘function calls’ thatled to some impossible calculation, such as the square root of a negative number. The calculationin question may have been attempted by an updater object trying to evaluate some function ofinterest. To figure out what the updater was trying to do, which node it was dealing with at the time,what the current values of that node and those in its Markov blanket are, and why these might haveled to some inconsistency (even if it were that simple), just from a list of function calls and thecurrent values of some ‘internal’ parameters, is a challenge indeed. As developers of the softwarewe have access to special tools for probing these ‘traps’ for more information but it can still bedifficult sometimes. It has been particularly difficult to fix any of these traps, or replace them withmore meaningful error messages, since they represent unanticipated errors—things that were notmeant to go wrong—it is virtually impossible to get hold of enough contextual information toprovide a message that might be of some use to the user.
Возникает подспудное подозрение, что проблеме охраны от нарушения инвариантов авторы таки уделили недостаточно внимания:-(