Comparison of programming languages

From Wikipedia, the free encyclopedia

This article is part of the
Programming Language Comparison
series.
General Comparison
Basic Syntax
Basic Instructions
Arrays
Associative arrays
String Operations
String Functions
Object-oriented programming
Database access

Evaluation strategy
List of "hello world" programs

Comparison of ALGOL 68 and C++
Compatibility of C and C++
Comparison of C and Pascal
Comparison of C++ and Java
Comparison of C# and Java
Comparison of C# and Visual Basic .NET
Comparison of ABAP and Java
This box: view  talk  edit


Programming languages are used for controlling the behavior of a machine (often a computer). Like natural languages, programming languages conform to rules for syntax and semantics.

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


[edit] 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. Please note that the following table may be missing some information.

Language Paradigm(s) Standardized?
ActionScript 3.0 imperative, object-oriented, event-driven Yes, ECMA
Ada concurrent, distributed, generic, imperative, object-oriented Yes, ANSI, ISO
ALGOL 58 imperative No
ALGOL 60 imperative Yes, ISO
ALGOL 68 concurrent, imperative No
APL array-oriented Yes, ISO
BASIC procedural Yes, ANSI
BLISS procedural No
Boo No
C imperative Yes, ANSI C89, ISO C90/C99
C++ imperative, object-oriented, generic Yes, ISO
C# imperative, object-oriented, generic, reflective Yes, ECMA, ISO
Chrome imperative, object-oriented, generic No
Clean functional, generic No
COBOL imperative, object-oriented Yes
ColdFusion procedural, object-oriented No
Common Lisp imperative, functional, object-oriented Yes
Curl event-driven, functional, imperative, object-oriented, generic, reflective No
D imperative, object-oriented, generic No
Dylan functional, object-oriented No
Eiffel imperative, object-oriented, generic Yes, ECMA, ISO[2]
Erlang functional, concurrent, distributed No
FP functional No
F# functional, object-oriented, imperative, generic No
Forth imperative, stack-oriented Yes, ANSI
Fortran imperative, procedural, object-oriented Yes
GraphTalk logic-oriented, object-oriented No
Groovy imperative, object-oriented, aspect-oriented No
Haskell functional, generic, lazy evaluation No
Io imperative, object-oriented No
J array-oriented, function-level, tacit No
Java imperative, object-oriented, generic, reflective No
JavaScript imperative, object-oriented, functional, reflective Yes
Joy functional, stack-oriented No
Lisp functional, reflective; others vary by dialect only Common Lisp
Lua procedural, imperative, reflective No
Mathematica functional, procedural No
MATLAB M-code imperative No
Modula-2 imperative, generic Yes, ISO/IEC 10514-1:1996
Modula-3 imperative, object-oriented, generic No
Oberon imperative, object-oriented No
Objective-C imperative, object-oriented, reflective Yes
Objective Caml object-oriented, functional, imperative, generic No
Object Pascal (Delphi) imperative, object-oriented, generic No
Oz logic, functional, imperative, object-oriented, concurrent - multi paradigm No
Pascal imperative, procedural Yes
Perl imperative, procedural, reflective, functional, object-oriented, generic No
PHP imperative, object-oriented, reflective No
Prolog logic Yes, ISO
Python imperative, object-oriented, functional, aspect-oriented, reflective No[3]
Ruby imperative, object-oriented, aspect-oriented, reflective No
S-Lang imperative, procedural No
Scala object-oriented, functional, generic No
Scheme functional Yes
Smalltalk object-oriented, concurrent, event-driven, imperative, declarative Yes, ANSI
Tcl imperative, procedural, event-driven No
Visual Basic component-oriented, event-driven No
Visual Basic .NET object-oriented, event-driven No
Visual Prolog logical, object-oriented, functional, event-driven, imperative, declarative No
Windows PowerShell imperative, object-oriented, functional, pipeline, reflective No
XL concept programming, imperative (by default), object-oriented (multiple models), No
Language Paradigm(s) Standardized?

[edit] Type systems

Language Type strength Type safety Expression of types "Compatibility" Type checking
ActionScript 3.0 strong safe static
Ada strong safe explicit nominative static
ALGOL 58 strong safe static
ALGOL 60 strong safe static
ALGOL 68 strong safe structural static or dynamic (tagged union)
APL strong safe dynamic
BASIC varies by dialect
BLISS none n/a n/a n/a n/a
Boo strong implicit
C weak unsafe explicit nominative static
C++ strong safe (but unsafe allowed) explicit, partially implicit nominative, structural static, dynamic
C# strong safe (but unsafe allowed) implicit nominative static
Clean strong implicit static
COBOL strong static
ColdFusion weak implicit dynamic
Common Lisp strong safe dynamic
Curl strong safe implicit, explicit nominative dynamic, static
D strong unsafe explicit static
Dylan strong safe dynamic
Eiffel strong safe nominative static
Erlang strong dynamic
F# strong safe implicit nominative static
Forth none n/a n/a n/a n/a
Fortran strong safe nominative static
GraphTalk weak
Groovy strong safe implicit dynamic
Haskell strong implicit structural static
Io strong dynamic
J strong safe dynamic
Java strong safe explicit nominative static
JavaScript weak dynamic
Joy strong safe dynamic
Lisp strong dynamic
Lua strong safe implicit dynamic
Mathematica strong dynamic
MATLAB M-code dynamic
Modula-2 strong safe (but unsafe allowed) explicit structural static
Modula-3 strong safe (but unsafe allowed) explicit structural static
Oberon strong safe explicit static
Objective-C strong explicit static
Objective Caml strong safe implicit structural static
Object Pascal (Delphi) strong safe (but unsafe allowed) explicit nominative static
Oxygene strong safe (but unsafe allowed) implicit static
Oz dynamic
Pascal strong safe explicit static
Perl weak implicit dynamic
PHP weak dynamic
Prolog strong dynamic
Python strong safe implicit dynamic
Ruby strong implicit dynamic
S-Lang strong safe dynamic
Scala strong partially implicit static
Scheme strong dynamic (latent)
Smalltalk strong safe implicit dynamic
Tcl dynamic
Visual Basic strong safe nominative static
Visual Basic .NET strong static
Visual Prolog strong safe nominative static
Windows PowerShell strong safe implicit dynamic
XL strong safe nominative static
Language Type strength Type safety Expression of types "Compatibility" Type checking

[edit] Usage

Language Intended use Design goals
ActionScript 3.0 Web design
Ada Embedded, Realtime applications Reliability
ALGOL Application Readability, Structure
APL Data processing Terseness, Expressiveness
AutoIt Automation, Scripting Very quick development
BASIC Education Simplicity
BLISS System Type free
Boo Application Python-like syntax, extensibility
C System Low level access, Minimal constraint
C++ Application, System Abstraction, Efficiency, Compatibility
C# Application Rapid application development
Chrome Application Extends Object Pascal to work on .NET
Clean General Correctness, Modularity
COBOL Business and Financial Applications Readability
ColdFusion Web Development Rapid Application Development, Ease of use
Common Lisp General Standardize Lisp
Curl Rich Internet Applications Efficiency, Fast Compilation, Expressiveness
D Application, System Compilability, Correctness, Efficiency
Dylan Application, General Dynamic but well-suited for commercial software
Eiffel Application Correctness, Efficiency, "Design by contract"
Erlang Telecom and distributed applications Fault tolerance, Scalability
F# Application
Forth Application, Embedded systems Compact implementations
Fortran Scientific and numeric applications Runtime efficiency, Simple syntax
GraphTalk
Groovy Application JVM compatibility
Haskell Application Lazy evaluation, Explicit side-effect
Io Application, Host-driven Scripting
J Data processing Terseness, Expressiveness, Powerful Data Manipulation
Java Application "Write once run anywhere"
JavaScript Client side web scripting
Joy Functional programming research Concatenative
Lisp General Simple notation for Lambda calculus, Homoiconicity
Lua Host-driven Scripting Small, embedded, configuration.
Mathematica Numeric computation and visualization
MATLAB M-code Numeric computation and visualization
Modula-2 Application, systems programming Source modules, Co-routines, Brevity.
Modula-3 OO extension of Modula-2
Oberon Application, Type-safe systems programming Simplicity, safety and efficiency; Simplifed Modula-2
Objective-C Application Smalltalk like, Component based code reuse, C compatibility
Objective Caml Application Efficiency, Robustness, Correctness
Object Pascal (Delphi) Application, System Readability, Rapid application development, Modularity
Oz Education
Pascal Education Readability, Discipline, Modularity
Perl Text processing, Scripting Terseness, Expressiveness
PHP Web Application, CLI Robustness and Simplicity
Prolog Problem solving, Artificial intelligence Declarative programming
Python Application, Education, Scripting Simplicity, Readability, Expressiveness, Modularity
REALbasic Application Rapid application development, Simplicity, Multi-platform
Ruby Application, Scripting Expressiveness, Readability
S-Lang Application, Numerical, Scripting Small footprint, Embedded, Fast Numerics
Scala Education
Scheme General, Education Minimalistic, Lexical Scoping
Smalltalk Application, Education Uniformity, Pure object oriented
SNOBOL Text processing
Tcl Application, Scripting
Visual Basic Application Rapid application development, Simplicity
Visual Basic .NET Application Rapid application development, Simplicity
Windows PowerShell Automation, Scripting Applicability, "One language to program them all"
XL
Language Intended use Design goals

[edit] Expressiveness

Language Statements ratio[4] Lines ratio[5]
C 1 1
C++ 2.5 1
Fortran 2.5 0.8
Java 2.5 1.5
MS Visual Basic 4.5  ?
Perl 6 6
Smalltalk 6 6.25
Python 6 6.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.[6] 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 The Computer Language Benchmarks Game.

[edit] 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 Benchmarks Game 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.

[edit] See also

[edit] References

  1. ^ As of May 2006 Diarmuid Pigott's Encyclopedia of Computer Languages hosted at Murdoch University, Australia lists 8512 computer languages.
  2. ^ ECMA-367; ISO/IEC 25436:2006
  3. ^ Language changes are done using a formally documented procedure, starting with a Python Enhancement Proposal (PEP)s. Python version releases are accompanied with a Language Reference Manual showing syntax and semantics; a reference implementation, and test suite. These are used to generate other Python implementations such as Jython and IronPython
  4. ^ 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.
  5. ^ 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.
  6. ^ From On the Expressive Power of Programming Languages, Matthias Felleisen, ESOP '90 3rd European Symposium on Programming.

[edit] External links