Binding time
When a binding occurs in software
In computer programming, binding time describes when an association is made in software between two data or code entities. This may occur either before or after execution starts. Early (a.k.a. static) binding occurs before the program starts running and cannot change during runtime. Late (a.k.a. dynamic or virtual) binding occurs as the program is running. Binding time applies to any type of binding including name, memory (i.e. via malloc), and type (i.e. for literals).
01Examples
The following Java code demonstrates both binding times. The method foo is early-bound to the code block that follows the function declaration on line 3. The call to add is late-bound since List is an interface, so list must refer to a subtype of it. list may reference a LinkedList, an ArrayList, or some other subtype of List. The method referenced by add is not known until runtime.
- import java.util.List; public void foo(List<String> list) { list.add("bar"); }
Sources and credits
This article is adapted from the Wikipedia article “Binding time”, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.
Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.