Your continued donations keep Wikipedia running!    

Comparison of programming languages

From Wikipedia, the free encyclopedia

Jump to: navigation, search

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.

Contents

General comparison

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

Language General model of execution Influences Paradigm(s) Typing discipline Introduced
Ada Compilation Algol, Pascal, C++ (Ada 95), Smalltalk (Ada 95) concurrent, distributed, generic, imperative, object-oriented static, strong, safe, nominative 1983
C Compilation Algol, B imperative, flow-driven static, weak, unsafe 1973
C++ Compilation C, Simula, Algol 68 imperative, object-oriented, generic static, strong, unsafe, nominative 1980
C# JIT compilation Delphi, Java, C++ imperative, object-oriented, generic, multi-platform static, strong, both safe and unsafe 2000
COBOL Compilation FLOW-MATIC, COMTRAN imperative, object-oriented weak/strong 1959
ColdFusion JIT compilation HTML procedural, functional, object-oriented dynamic (duck), weak 1995
Common Lisp Compilation Lisp, Smalltalk imperative, functional, object-oriented dynamic, strong, safe 1984
D Compilation C , C++, Java, C# imperative, object-oriented, generic strong 2000
Eiffel Compilation Ada, Pascal object-oriented, generic static, strong, safe, nominative, contracts 1985
Erlang Compilation Prolog, Ericsson Pascal, CSP functional, concurrent, distributed, multi-platform dynamic, weak late 1980s
Forth Interpretation / Compilation none imperative, stack-oriented typeless 1977
Fortran Compilation none imperative static, strong, safe, nominative 1957
Java Interpretation / JIT compilation C++, Objective-C object-oriented, multi-platform, generic static, strong 1994
JavaScript Interpretation C, Self, awk, Perl imperative, object-oriented, functional dynamic 1995
Haskell Interpretation / Compilation Miranda, ML functional, generic static, strong, type inference 1998
Mathematica Interpretation Lisp functional, procedural dynamic, strong 1986
Objective-C Compilation C, Smalltalk object-oriented static/dynamic hybrid, strong 1986
Objective Caml Interpretation / Compilation ML, Lisp object-oriented, functional static, safe, structural, type inference 1996
Object Pascal Compilation Pascal imperative, object-oriented static, strong, safe (but unsafe allowed), nominative 1995
Perl Interpretation C, shell, awk, sed, Lisp functional, object-oriented, procedural dynamic 1987
PHP Interpretation Perl, C imperative, object-oriented dynamic, weak 1995
Python Interpretation ABC, Perl, Modula-3 imperative, object-oriented, functional dynamic (duck), strong 1991
Ruby Interpretation Smalltalk, Perl imperative, object-oriented, functional dynamic (duck), strong 1995
Scala Interpretation / Compilation Java object-oriented, functional static, strong 2003
Scheme Interpretation / Compilation Lisp, Algol 60 functional dynamic 1975
Smalltalk JIT compilation Sketchpad, Simula object-oriented, functional, concurrent, event-driven, imperative, declarative dynamic, strong, safe, duck 1971
Visual Basic Compilation QuickBASIC component-oriented, event-driven static/dynamic hybrid, weak/strong hybrid, safe, nominative 1991
Visual Basic .NET JIT compilation Visual Basic object-oriented, event-driven static, strong 2001

Expressiveness

Language Statements ratio[2] Lines ratio[3]
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.[4] 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 Diarmuid Pigott's Encyclopedia of Computer Languages hosted at Murdoch University, Australia lists 8512 computer languages.
  2. ^ 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.
  3. ^ 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.
  4. ^ From On the Expressive Power of Programming Languages, Matthias Felleisen, ESOP '90 3rd European Symposium on Programming.

External links