What does "expressive" mean when referring to programming languages?

morgancodes picture morgancodes · Mar 12, 2009 · Viewed 19.9k times · Source

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?

Answer

slim picture slim · Mar 12, 2009

'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:

  • intuitively readable constructs
  • lack of boilerplate code

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.