Have you noticed the difference between Object Spy and Object Repository. Did you check the way both represents the hierarchy of same object is different. For example, if you spy on username field on Mercury Tours website, you will notice that there are many nested Web Tables after Browser > Page. Whereas if the same object (for example – username edit box) is added into the object repository, it does not show those nested tables. Have you ever wondered, where does those tables and other objects went away and not sure why it was showing at the first place.
UFT sieves away the extra objects in hierarchy for better readability and maintainability when objects get added into the Object Repository (OR). You can dig into the hierarchy and reach to the object you want to, because of the application inner control hierarchy. Like, given a parent as Browser, you can recursively run through all its children (Page, WebTable, WebTable etc.) until you find the username edit box control. You basically need the higher and lower level in the hierarchy to specifically point to a particular object. UFT removes the rest, as they might just function as a container or framing host for the objects.
The full hierarchy in the Object Spy enables us to identify the parent objects from where a particular object can be retrieved during run time. Object Spy is a developer tool, which helps you to get the insight of a control. In our case it would be a Test Object. It shows, how the control are structured or the inner control structure. It shows the full description of the objects you spy, in order to provide you the complete detail of the application under test.
Object spy does not store the full description of the objects, it just displays all the information. Whereas Object Repository stores the description and properties. Just assume how bulky it will be when the OR will store the full description for each and every object. Also it will contain redundant information, which is of no use at all to you for automation. The full description in the object spy helps in descriptive programming extensively.