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 terms two terms are only used to describe a language as being more or less, relative to than another language.

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

Example: Is C# more verbose than Java?

up vote 30 down vote accepted

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

  • 5
    +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. – Frank Shearar Feb 21 '11 at 15:39
  • 5
    @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 '11 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. – David Thornley Feb 21 '11 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. – David Mulder Mar 27 '12 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.) – Frank Shearar Mar 27 '12 at 19:49

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#.

  • 1
    Java now supports lambda expressions with Java 8 (docs.oracle.com/javase/tutorial/java/javaOO/…) – shanraisshan Dec 1 '16 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 '17 at 11:09
  • 1
    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 '17 at 17:48

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.

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
  • 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 '17 at 17:57

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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