Skip to main content

Posts

Showing posts from January, 2011

Late Binding in Programming Languages

Late binding is key to enhanced productivity in programming languages. I believe that this is the single most important reason why so-called dynamic typed languages are so popular.

This note is part of an ongoing ‘language design’ series which aims to look at some key aspects of programming language design.

What do we mean by late binding?
Simply put, a programmer should not have to say more than they mean at any particular time.

To see what I mean, consider a function that computes a person's name from a first and last name. In Star, I can write this:

fullName(P) is P.firstName()++P.lastName()

This constitutes a complete definition of the function: there is no need to declare types; furthermore this function will work with any type that has a first and last name.

Contract this with a typical well-crafted Java solution:

boolean fullName(Person P){
return P.firstName()+P.lastName();
}

Not so different one might argue.

Except that we have had to define a type Person; at best this is an inte…

Productivity gains are permanent, Performance losses are temporary

This is the first in a short series of notes about language design. The goal is to identify what is truly important about programming language design.

It is all about productivity
There are 'too many moving parts' in a typical Java program.

Here is a simple straw-man example: iterating over a collection. Before Java 5, the paradigmatic way of iterating over a collection was to use a fragment like:

for(Iterator it=coll.iterator();it.hasNext();){
SomeType el = (SomeType)it.next();
...
}

There is a lot of 'clutter' here; but worse, there are a lot of concepts that are not really that important to the problem at hand.

Compare that to the Java 5 version:

for(SomeType el:coll){
...
}

Here we can focus on exactly what is needed: the collection and the iteration.

This kind of example can be repeated fractally up the entire stack of abstractions: not just at this micro level but also at the level of using standard JDK class libraries on through to using features such as Spring/Hibernate…