Merits of Static versus Dynamic Binding

As I noted earlier in this chapter, both static and dynamic languages have existed almost since the birth of high level programming langauges. And for almost as long, people have argued the relative merits of the two different approaches. These arguments usually reduce to three different issues:

The first is efficiency. Static binding means decisions are being made at compile time, and thus run time can be made very fast. Dynamic binding means decisions must be made at run time, and this slows execution speed. On the other hand, advocates for dynamic binding ask whos time you should be measuring, the programmers or the computers? They claim that dynamic languages are easier to use, and thus program development will be faster, even if execution is slower.

The second issue is error detection. Advocates of static binding claim that it permits errors to be detected at compile time. Advocates of dynamic binding claim these errors are quickly found any way (perhaps the first time a program is run), and hence the benefit is not worth the cost.

The third issue is flexibility. Advocates of dynamic binding claim that static binding creates rigidity and inhibits reuse, and that this is the real benefit for dynamic languages.

The real answer is that both sides make valid points, and that all programming languages represent a compromise of competing goals.

[audio] [real] Text to accompany slide13, in Chapter 10 of An Introduction to Object-Oriented Programming