Late binding

In computing, late binding or dynamic linkage[1]—though not an identical process to dynamically linking imported code libraries—is a computer programming mechanism in which the method being called upon an object, or the function being called with arguments, is looked up by name at runtime. In other words, a name is associated with a particular operation or object at runtime, rather than during compilation. The name dynamic binding is sometimes used,[2] but is more commonly used to refer to dynamic scope.

With early binding, or static binding, in an object-oriented language, the compilation phase fixes all types of variables and expressions. This is usually stored in the compiled program as an offset in a virtual method table ("v-table").[3] In contrast, with late binding, the compiler does not read enough information to verify the method exists or bind its slot on the v-table. Instead, the method is looked up by name at runtime.

The primary advantage of using late binding in Component Object Model (COM) programming is that it does not require the compiler to reference the libraries that contain the object at compile time. This makes the compilation process more resistant to version conflicts, in which the class's v-table may be accidentally modified. (This is not a concern in just-in-time compiled platforms such as .NET or Java, because the v-table is created at runtime by the virtual machine against the libraries as they are being loaded into the running application.[4])

  1. ^ Schreiner, Axel-Tobias (1994). Object-Oriented Programming With ANSI-C (PDF). Munich: Hanser. p. 15. ISBN 3-446-17426-5.
  2. ^ Booch, Grady. Object-oriented Analysis and Design. Addison-Wesley, 1994. p71
  3. ^ "Using early binding and late binding in Automation". Microsoft. 2003-09-06. Archived from the original on 2014-06-27. Retrieved 2014-06-27.
  4. ^ "The Structure of the Java Virtual Machine: Dynamic Linking". Sun Microsystems. 1999. sec. 3.6.3. Retrieved 2013-09-21.

© MMXXIII Rich X Search. We shall prevail. All rights reserved. Rich X Search