I hear this word a lot in sentences like "javascript is a very expressive language". Does it just mean there aren't a lot of rules, or does "expressive" have a more specific meaning?
MacIver which interviewed 2576 programmers using the Hammer Principle. According to Maclver, the most expressive languages are Haskell, Clojure and Scala while the least expressive are C, PHP and ultimately TCL. Maclver's study did not include CoffeeScript.
Python is an expressive language. Expressive in this context means that a single line of Python code can do more than a single line of code in most other languages. The advantages of a more expressive language are obvious – the fewer lines of code you write, the faster you can complete the project.
C++ is a very rich, very expressive language with lots of features. It has to be because a successful general-purpose programming language must have more facilities than any one developer needs, and a living and evolving language will accumulate alternative idioms for expressing an idea.
Java comes in with nearly identical expressiveness as C++ (both at 823 LOC/commit) but a vastly greater consistency (IQR of 277 vs 476).
'Expressive' means that it's easy to write code that's easy to understand, both for the compiler and for a human reader.
Two factors that make for expressiveness:
Compare this expressive Groovy, with the less expressive Java eqivalent:
3.times { println 'Hip hip hooray' }
vs
for(int i=0; i<3; i++) { System.out.println("Hip hip hooray"); }
Sometimes you trade precision for expressiveness -- the Groovy example works because it assumes stuff that Java makes you to specify explicitly.
I take it to mean that it's capable of expressing ideas/algorithms/tasks in an easy-to-read and succinct way.
Usually I associate a language being expressive with syntactic sugar, although that's not always the case. Examples in C# of it being expressive would be:
foreach
(instead of explicitly writing the iteration)using
statement (instead of explicitly writing the try/finally)A different example would be generics: before C# got generics, you couldn't express the idea of "an ArrayList
containing only strings" in code. (You could document it, of course, or write your own StringList
type, but that's not quite the same.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With