jargon

Comparison

Dynamic dispatchvsLate binding

Dynamic dispatch

the method that runs is chosen by what the object actually is at that moment, not by the type the variable was declared with.

The runtime lookup that decides which implementation a call lands on, based on the receiving object rather than the compile-time type. It is what makes polymorphism work and what makes a call slightly slower and harder for a compiler to inline. Knowing it is dispatch rather than magic is what lets you reason about why a base-class method calling an overridden method runs the subclass version — the source of most surprises in a deep hierarchy.

Full entry →

Late binding

which implementation runs was decided when the program started, from a config value, not when it was compiled.

Deferring the decision of which code a call reaches until as late as possible — runtime rather than compile time. It is the property that makes plugins, hot-swappable strategies and configuration-driven implementations possible, and it is what you give up in exchange when you choose the safety of a direct call. Every technique in this cluster is a way of choosing where on that spectrum a particular decision should sit.

Full entry →

Related comparisons