Programming Paradigms and Expressive Power
I recently watched a talk by Uncle Bob Martin called The Last Programming Language. Since I had just written a post relating indirection mechanisms to expressive power, I was intrigued by Uncle Bob's idea and wanted to explore it further.
Uncle Bob gives a brief history of programming paradigms. Here are the ones he mentions:
His perspective was that programming paradigms are generally subtractive.
- Modular programming removed large programs
- Structured programming removed GOTOs
- Object Oriented programming removed hand-rolled vtables
- Functional programming removed mutable state
He concludes by saying that there's nothing left to take away and a language of the future would have to have all of these.
Perspective is worth 80 IQ points. --- Alan Kay
The idea that paradigms are subtractive is interesting. It is interesting to look at what is taken away. However, I would rather say that paradigms replace a manual, error-prone pattern with a more reliable one (usually through indirection). Structured programming didn't just ban GOTO. It also encouraged conditionals and loops. Object Oriented programming didn't just prohibit tables of function pointers, it gave a unified syntax and semantics for message dispatch. But, still, I do appreciate the perspective.
On the other hand, I think Uncle Bob has left out many interesting paradigms from his history. Wikipedia lists 59 paradigms in a hierarchy. (Note that they are not mutually exclusive!) Let's see if we can app ly his subtractive perspective to those paradigms.
Aspect-oriented programming
. . . aims to increase modularity by allowing the separation of cross-cutting concerns.
What does it remove?
The mixing of concerns.
Concatenative programming
A concatenative programming language is a point-free programming language in which all expressions denote functions and the juxtaposition of expressions denotes function composition.
What does it remove?
Explicit arguments to functions (point-free!).
Constraint programming
. . . is where relations between variables are stated in the form of constraints.
What does it remove?
Specifying the sequence of steps to execute.
Logic programming
. . . is the use of mathematical logic for computer programming.
What does it remove?
Much like constraints, it removes the explicit steps to execute.
Array programming
. . . is the generalization of operations on scalar values to apply transparently to vectors, matrices, and higher dimensional arrays.
What does it remove?
The distinction between scalar and vector quantities.
Language-oriented programming
. . . is the creation of a domain-specific language for the problem, then solve the problem in that language.
What does it remove?
General purpose programming languages.
One more.
Event-driven programming
. . . means the flow of the program is determined by response to events.
What does it remove?
The main
function?
The perspective has some merits. But it also has flaws. I've already mentioned that it does not specify what the removed thing is replaced with, which may be more important than the removal itself. Also, the perspective probably does not apply to all programming paradigms, as Uncle Bob claims. He's exhibiting a blindness toward the possibility of future change because he can't imagine it.
I also don't think we have come to the end of programming paradigms. Although I can't predict what paradigms will be invented in the future (if I could, I'd just invent it), I don't think we're looking at mere incremental improvement. It's just that after racking my brain I can't come up with much.
This video holds some ideas.