What Is Object Binding?

Object binding in computer programming can have several specific meanings in different contexts but, in general, refers to associating and synchronizing one object, variable or method with another. This association, once established, is usually managed by the underlying program environment and not through explicitly written code from the programmer. In one specific context, object binding refers to the linking of an object with a user interface component so changes to the component modify data within the object. In another context, object binding can refer to the specific way in which a compiler resolved calls to functions or methods during program execution. The concept of object binding is often seen as a subset of a larger set of associative behaviors known as data binding.

When speaking about databases, business applications and web-based user interfaces, object binding is used to describe the relationship between an interface component and a data object that is present to act as an intermediary between a database and that component. Through the use of object binding, changes to a user interface component such as a drop-down box can have the new values automatically relayed to the data object. This removes the need for repetitive code that simply checks for changes to the interface component and assigns those changes to the data object over and over. There are limitations to this type of binding, however, and the intermediary data object must still provide its own code to access the database or other data source to either load or save information.

In a more general programming perspective, object binding does not have to involve databases or user interface components at all. Instead, it is a term that can be used to indicate that two objects are somehow linked or synchronized so changes to a part of one can change a part of the other. It is most common with user interface components, though, because user input tends to be unpredictable and generates easily captured events that can be used to trigger updates to the data object.

Within the realm of object-oriented programming, object binding can be used to mean something very different. It can refer to the way in which calls to methods or variables within an object are resolved while a program is running, and how the compiler makes these decisions. The two main types are known as early and late binding. Early binding indicates the method or variable being called is static or predictable in nature, so calls in the program are compiled so they are bound to a single, unchanging memory address that holds the code. Late binding means the exact method or variable could be different and is unpredictable, as could be the case with inherited methods of an object that are overridden by subclasses, in which case the memory address that needs to be accessed can only correctly be calculated while the program is running and not beforehand.