Jump to content

Comparison of programming languages

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Cadrian~enwiki (talk | contribs) at 08:42, 19 July 2006 (General comparison: Eiffel). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Programming languages are used for controlling the behavior of a machine (often a computer). Like human languages, programming languages have syntactic and semantic rules used to define meaning.

There are thousands of programming languages[1] and new ones are created every year. Few languages ever become sufficiently popular that they are used by more than a few people, but many professional programmers use dozens of different languages during their career.

General comparison

The following table compares general and technical information for a selection of programming languages. See the individual languages' articles for further information.

Language General model of execution Influences Paradigm(s) Typing discipline Introduced SERP[2] rank[3] SERP rank change (1 yr)[4]
Ada Compilation Algol, Pascal, C++ (Ada 95), Smalltalk (Ada 95) concurrent, distributed, generic, imperative, object-oriented static, strong, safe, nominative 1983 18 0
C Compilation Algol, B imperative, flow-driven static, weak 1973 2 -1
C++ Compilation C, Simula, Algol 68 imperative, object-oriented, generic static, weak 1980 3 +1
C# JIT compilation Java, C++, Delphi object-oriented static, strong, both safe and unsafe, nominative 2000 7 0
COBOL Compilation FLOW-MATIC, COMTRAN imperative, object-oriented weak 1959 15 -1
ColdFusion Interpretation HTML procedural, functional, object-oriented dynamic (duck), weak 1995 16 +9
Common Lisp Compilation Lisp, Smalltalk imperative, functional, object-oriented dynamic 1984 14 +1
D Compilation C , C++, Java, C# imperative, object-oriented, generic strong 2000 19 +8
Delphi Compilation Pascal, Object Pascal imperative, object-oriented static, strong, safe (but unsafe allowed), nominative 1995 10 -1
Eiffel Compilation Ada, Pascal object-oriented, generic static, strong, safe, nominative, contracts 1985
Erlang Compilation
Forth Interpretation/Compilation none imperative, stack-oriented typeless 1977 38 ?
Fortran Compilation none imperative static, strong, safe, nominative 1957 ? ?
Java Interpretation/JIT compilation C++, Objective-C, C# object-oriented static, strong 1994 1 +1
JavaScript Interpretation C, LiveScript imperative, object-oriented, functional dynamic 1995 9 +2
Haskell Interpretation / Compilation Miranda, ML functional, generic static, strong, type inference 1998 >50 ?
Mathematica Interpretation Lisp functional, procedural dynamic, strong 1986 >50 ?
Objective-C Compilation C, Smalltalk object-oriented static/dynamic hybrid, strong 1986 49 ?
Objective Caml Compilation ML, Lisp object-oriented, functional static, safe, structural, type inference 1980's? ? ?
Perl Interpretation C, shell, awk, sed, Lisp functional, object-oriented, procedural dynamic 1987 6 -3
PHP Interpretation Perl, C imperative, object-oriented dynamic, weak 1995 4 +1
Python Interpretation ABC, Perl, Modula-3 imperative, object-oriented, functional dynamic (duck), strong 1991 8 0
Ruby Interpretation Smalltalk, Perl imperative, object-oriented, functional, concurrent dynamic (duck), strong 1995 20 +10
Scala Interpretation / Compilation Java object-oriented, functional static, strong 2003
Scheme Interpretation / Compilation Lisp, Algol 60 functional dynamic 1975 14 +1
Smalltalk JIT compilation Sketchpad, Simula object-oriented, functional, concurrent, event-driven, imperative, declarative dynamic, strong, safe, duck 1971 35 ?
Visual Basic Compilation QuickBASIC event-driven static/dynamic hybrid, weak/strong hybrid, safe, nominative 1991 5 +1
Visual Basic .NET JIT compilation Visual Basic object-oriented, event-driven static, strong 2001 17 +11

Expressiveness

Language Statements ratio[5] Lines ratio[6]
C 1 1
C++ 2.5 1
Fortran 2 .8
Java 2.5 1.5
Perl 6 6
Python 6 6.5
Smalltalk 6 .625
MS Visual Basic 4.5 ?

The literature on programming languages contains an abundance of informal claims about their relative expressive power, but there's no framework for formalizing such statements nor for deriving interesting consequences.[7] This chart provides two measures of expressiveness from two different sources. An additional measure of expressiveness, in GZip bytes, can be found with the Compare to tool on the Computer Languages Shootout.

Benchmarks

Benchmarks are designed to mimic a particular type of workload on a component or system. The computer programs used for compiling some of the benchmark data in this section may not have been fully optimized, and the relevance of the data is disputed. The most accurate benchmarks are those that are customized to your particular situation. Other people's benchmark data may have some value to others, but proper interpretation brings many challenges. See this page about flawed benchmarks and comparisons. The Computer Language Shootout Benchmarks site contains a large number of micro-benchmarks of reader-contributed code snippets, with an interface that generates various charts and tables comparing specific programming languages and types of tests.

References

  1. ^ As of May 2006 The Encyclopedia of Computer Languages by Murdoch University, Australia lists 8512 computer languages.
  2. ^ Several search terms were used, per language, for language identifiers in determining SERP rankings.
    • Awk: awk, gawk, mawk, nawk
    • C#: C#, C-Sharp, C Sharp
    • ColdFusion: ColdFusion, Cold Fusion, CFMX, CFML
    • D: Exclude "3-D Programming"
    • Delphi/Kylix: Delphi, Kylix
    • IDL: Exclude "corba"
    • Lisp/Scheme: Lisp, Scheme
    • Python: Python, Jython, IronPython (Jan Persson)
    • T-SQL: T-SQL, Transact-SQL
    • Tcl/Tk: Tcl/Tk, Tcl, Tk
    • VB.NET: VB.NET, Visual Basic.NET, Visual Basic .NET, Visual Basic 2005, VB 2005
    • Visual FoxPro: FoxPro, Fox Pro, VFP
  3. ^ The relevance of the TIOBE data is disputed for anything other than estimating how much Internet coverage there is of certain programming languages. Search engine results may not correspond to actual language popularity. The data comes from the first column of the May, 2006 TIOBE Programming Community Index. Languages are ranked sequentially from most to fewest search engine results using the method described on TIOBE's Definition page:
    The ratings are calculated by counting hits of the most popular search engines. The search query that is used is
    +"<language> programming" -tv -channel
    The search query is executed for the regular Google, MSN, and Yahoo! web search and the Google newsgroups for the last 12 months. The web site Alexa.com has been used to determine the most popular search engines. The word "tv" and "channel" have been filtered out here to avoid any interference with TV programs. Otherwise languages such as ABC and Scheme would have been highly overrated.
    By applying the search engine query as defined above, a lot of hit counts are collected. Let's define "hits(PL#i,SE)" as the number of hits of programming language PL at position i of the TPC index for search engine SE. The counted hits are normalized for each search engine for the first 50 languages. More formally, the rating for PL#i becomes
    ((hits(PL#i,SE1)/hits(PL#1) + ... + hits(PL#50)) + ... + (hits(PL#i,SEn)/hits(PL#1) + ... + hits(PL#50)))/n
    In determining search engine result count for a language, the language may include or exclude certain dialects or other languages. See what's included or excluded in the Exceptions and inclusions chart below.
  4. ^ From the Delta in Position column of the May, 2006 TIOBE Programming Community Index. This number indicates the language's change in SERP rank (see above footnote) over the last year. In determining the SERP rank change for a language, the language may include or exclude certain dialects or other languages. See what's included or excluded in the Exceptions and inclusions chart below.
  5. ^ Data from Code Complete. The Statements ratio column "shows typical ratios of source statements in several high-level languages to the equivalent code in C. A higher ratio means that each line of code in the language listed accomplishes more than does each line of code in C.
  6. ^ The ratio of line count tests won by each language to the number won by C when using the Compare to feature at http://shootout.alioth.debian.org/debian/c.php. Last updated May, 2006. C gcc was used for C, C++ g++ was used for C++, Fortran G95 was used for Fortran, Java JDK Server was used for Java, and Smalltalk GST was used for Smalltalk.
  7. ^ From On the Expressive Power of Programming Languages, Matthias Felleisen, ESOP '90 3rd European Symposium on Programming.