One of the most interesting features in Mole 2010 is the ability to compare objects. The tool enables you to effectively “diff” the property and field values of two different objects or of the same object at various points in time. If you are comparing two different objects they do not even need to be of the same type.
This feature makes it easy to track changes to an object while your application is running. It also makes it easy to detect differences (or lack of differences) between any two objects in your application. To my knowledge, Visual Studio 2010 does not natively support this type of debugging capability.
Here’s a quick walkthrough, showing how to leverage this feature in Mole 2010.
Suppose we have an application that shows information about people, and lets the user edit that information using a data entry screen. One day while debugging a problem with that data entry screen we open up Mole 2010 and navigate to a Person object that will be edited.
Since we are about to test the data entry screen, we capture the state of the Person object and save it to disk.
Next we close Mole 2010, continue executing the application, edit some values on the Person object, click a Save button, hit a breakpoint and fire up Mole 2010 again. After navigating back to the Person object we just finished editing, the MoloScope contains the object’s updated values.
At this point, it is easy to verify whether the changes we made were applied to the Person object or not. Simply load up the file we saved moments ago and compare the property and field values in it against the values in the MoloScope.
After loading up the comparison file, we can visually diff the two objects to see what changed and what didn’t change. The properties/fields whose value changed are bold and red, with a tooltip that displays the value loaded from the file.
In case you want to see all of the changed properties at a glance, sort on the Value column by clicking the column header. When objects are being compared in the MoloScope, sorting the Value column will bring all of the changed items to the top of the list.
As I mentioned earlier, this feature can be used to compare any two objects, regardless of their data types. The properties and fields are compared by name. Whatever properties/fields that exist in the MoloScope will be compared against whatever values are in the data file.
You can learn more about the MoloScope here: http://www.molosoft.com/docs/moloscope/
You can buy a copy of Mole 2010 here: http://www.molosoft.com/purchase/