Your Online Resource Centre

Articles on Computer - Software

The following articles are for your enjoyment and are FREE to browse. If you would like to send a comment
to Dr. Duckie, then Click Here. Your feedback is always welcome.


Back to Article Index

The Active Observer Bug
By: Mauro Molino



Symptoms: a change of behaviour of our code depending on whether in release or debug mode.
This is sometimes referred to as 'Heisenbug', taking its name from quantum physics Heisenberg uncertainty principle.
Someone prefers to call it "the active observer bug", and this is maybe a more appropriate definition. What usually happens is that our debugging code simply interferes with the program. This happens if our debugging code alters the value of some variables, stack objects or pointers. A typical case, for example in Java, is calling the nextItem() method of an Iterator inside a snippet of debugging code to access the correspondig object. This will shift the iterator pointer to its next position, thus altering the flux of the program. The solution in this case is obviously to assign the result of the nextItem() call to an object outside the debugging code, and "observe" this object. Analogous cases are pushing or popping to/from a stack object, and so on. Less frequently it happens that even calling an apparently "innocuous" method on an object, notifications could be sent to listeners, again potentially causing the bug.
Though it may not seem, active observer bugs are much more frequent than one can expect, as we usually don't "debug our debugging code".
The golden rule is to double check that our debugging code is really "neutral" and behaves just like a passive observer and, if possible, always observe primitive data types.

Mauro is a professional developer, platform integration evangelist, free information supporter and owner/webmaster of beanizer.org. When not developing software, he composes music, mainly for the theatre.



Back to Article Index

Here are some other GREAT links brought to you by Dr. Duckie:

Relationships & Dating   |   Cooking, Recipes, & More   |   Music   |   Movies   |   Health, Fitness, & Wellbeing
Employment   |   Family   |   Personal Finance   |   Pets   |   Computers & Internet   |   Cars & Real Estate
Travel   |   Entertainment, Gambling, & Betting   |   Member Area   |   Contact Us

      
Check Out some great related Links Below:






null




LATEST TECHNOLOGY NEWS


Google
 
Web drduckie.com