18

Programming languages can often be described as verbose or terse.

From my understanding, a verbose language is easy to read and understand, while a terse language is concise and neat, but more difficult to read. Should there be other things to consider in the definitions?

It seems much of the popular programming languages of today are verbose, and these two terms are only used to describe a language as being more or less, relative to another language.

How do we determine if a programming language is more verbose/terse over another?

Example: Is C# more verbose than Java?

5 Answers 5

36

From my understanding, a verbose language is easy to read and understand, while a terse language is concise and neat, but more difficult to read.

This is false. Verbose means lots of symbols. Terse means fewer symbols.

This has nothing to do with ease of reading or ease of understanding.

Some folks find verbose COBOL easy to read, other find it confusing because so many symbols are required to do so little.

Some folks find terse I/J/K and APL easy to read because the program is very short. Others find it hard to read because the symbols are obscure.

Terse/Verbose has no relationship with easy to read or easy to understand.

Should there be other things to consider in the definitions?

No. The definitions of terse and verbose are fine.

What's important is that these definitions have nothing to do with "easy to read and understand"

It seems much of the popular programming languages of today are verbose.

Really?

How do we determine if a programming language is more verbose/terse over another?

Count tokens to get something done.

Add 2 TO A GIVING B.

7 tokens

b = a + 2;

6 tokens

http://dictionary.reference.com/browse/verbose

http://dictionary.reference.com/browse/terse

11
  • 7
    +1 for "Terse/Verbose has no relationship with easy to read or easy to understand." I always think of mathematical notation which, when properly done, is remarkably dense yet still relatively readable. Feb 21, 2011 at 15:39
  • 6
    @sunpech: That's what the English words mean. "verbose" means a lot of words. "terse" means fewer words. Nothing to do with readability. Simply word counts. All I did was replace "word" with "token". It's just English, nothing special.
    – S.Lott
    Feb 21, 2011 at 15:54
  • 1
    We might also consider the length of the tokens. Common Lisp looks wordy because so many of the keywords are long, and that also adds to the verboseness of COBOL. Feb 21, 2011 at 16:06
  • 1
    @Frank Shearar: Absolutely untrue, think about the time it takes for students to learn mathematics. It's as unreadable as it can get (serious mathematics) and even after 6 years of secondary education the majority still are unable to seriously read it. Not that being unreadable is a bad thing! But saying that mathematics is a readable notation is a shortsighted comment ot say the least. Mar 27, 2012 at 18:34
  • 2
    @DavidMulder: Mathematical notation varies wildly, so I suspect we're both committing sins of hyperbole. Surely you consider the notation for algebra, set theory, basic calculus to be transparent? On the other hand, I consider tensors' abstract notation to be unreadable nonsense. (But then, I also didn't take the time to learn the notation properly.) Mar 27, 2012 at 19:49
6

How do we determine if a programming language is more verbose/terse over another?

By comparing the equivalent or similar language constructs, specifically how the same or equivalent task can be solved in one language vs the other.

Is C# more verbose than Java?

Java is in general more verbose than C#. The most obvious differences include delegates and lambda expressions, where Java requires defining, subclassing and instantiating a distinct interface in order to achieve what is possibly done using a single lambda expression in C#.

3
  • 3
    Java now supports lambda expressions with Java 8 (docs.oracle.com/javase/tutorial/java/javaOO/…) Dec 1, 2016 at 7:54
  • 1
    @shanraisshan: yes, it got better over time, but AFAIK Java is still a little bit more verbose. For example, in the docs you linked to, the code contains lots of p.getAge() statements. In C#, I would create a property Age, which brings the same degree of encapsulation as a member function getAge, but makes it possible to write p.Age instead.
    – Doc Brown
    Jul 10, 2017 at 11:09
  • 2
    Also, while Java has improved, C# hasn't exactly been a static target either ... New features since this answer like generator functions and async/await also serve to allow C# code to be shorter than Java equivalent.
    – Jules
    Jul 10, 2017 at 17:48
6

Give a code snippet to non-programmer and ask him/her to explain what that snippet trying to do. If you get closest answer, then it is verbose. if you get WTF expression then it is terse.

1
  • 1
    A terse language will look like a monkey has been randomly bashing keys on the keyboard.
    – Simon B
    Dec 14, 2021 at 17:23
2

The measure is called expressiveness of the language. The typical metric for this is measuring standardized lines of code or statements needed to implement same functionality.

Some values from the Wiki -- how many statements/lines of C code does it take to implement one functionality of one statement/line in:

  • C -- statements: 1 lines: 1
  • C++ -- statements: 2.5 lines: 1
  • Fortran -- statements: 2.5 lines: 0.8
  • Java -- statements: 2.5 lines: 1.5
  • Perl -- statements: 6 lines: 6
  • Smalltalk -- statements: 6 lines: 6.25
  • Python -- statements: 6 lines: 6.5
1
  • 1
    I think the fact that one of these measurements suggests that FORTRAN is more expressive than C by some margin (!) while the other states the opposite while stating that C++ is equally expressive to C (!!) sums up the usefulness of such "metrics".
    – Jules
    Jul 10, 2017 at 17:57
-1

Swift is very terse and readable. COBOL is very verbose and I find it hard to read. You need to use a language in real life and decide. And “readable” depends on how much you are used to it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.