I’ve long been complaining — some would say bitching — about how verbose it is to code in many languages today. In many cases I am sorry witness to people programming in C/C++ or Java and writing thousands upon thousands of lines of code only to end up with a piece of code that coudl easily have been expressed in a denser language in a few hundred lines of code. Today I came across a nice table produced by Larsson Omberg comparing the code required to do some value decomposition in Mathematica, Matlab, and Python. It’s from 2005 but much of this probably still holds for his example. What we see is the following: Mathematica: 276 lines of code Matlab: 52 lines of code Python: 71 lines of code What we see is a density advantage of 5 times for Matlab and about 4 for Python over Mathematica. And Mathematica is already a dense language. Imagine coding the same solution in C/C++ or Java? We’d probably see at least twice as much code over Python for C/C++ and Java. That means the Mathematica code would be 10 times as dense, an order of magnitude. What that means is that on
