FACTOID # 43: Japanese and South Korean kids are the best in the world at science and maths.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

FACTS & STATISTICS    Simple view

  1. Select countries to view: (hold down Control key and click to select several)

     

     

    Compare:

     

     

  1. Select fact or statistic: (* = graphable)

     

     

     

  2. (OPTIONAL) Compare to statistic: (both need to be graphable)

     

     

     

  3. View result as:

     

       
(OR) SEARCH ALL encyclopedia, stats & forums:   

Encyclopedia > Declarative programming

Declarative programming is a term with two distinct meanings, both of which are in current use.


According to one definition, a program is "declarative" if it describes what something is like, rather than how to create it. For example, HTML web pages are declarative because they describe what the page should contain — title, text, images — but not how to actually display the page on a computer screen. This is a different approach from imperative programming languages such as Fortran, C, and Java, which require the programmer to specify an algorithm to be run. In short, imperative programs explicitly specify an algorithm to achieve a goal, while declarative programs explicitly specify the goal and leave the implementation of the algorithm to the support software (for example, a SQL select statement specifies the properties of the data to be extracted from a database, not the process of extracting the data). HTML, short for Hypertext Markup Language, is the predominant markup language for the creation of web pages. ... In computer science, imperative programming, as opposed to declarative programming, is a programming paradigm that describes computation in terms of a program state and statements that change the program state. ... Fortran (previously FORTRAN[1]) is a general-purpose[2], procedural,[3] imperative programming language that is especially suited to numeric computation and scientific computing. ... C is a general-purpose, block structured, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. ... Java is a programming language originally developed by Sun Microsystems and released in 1995. ... In mathematics, computing, linguistics, and related disciplines, an algorithm is a finite list of well-defined instructions for accomplishing some task that, given an initial state, will terminate in a defined end-state. ... SQL (IPA: or IPA: ), commonly expanded as Structured Query Language, is a computer language designed for the retrieval and management of data in relational database management systems, database schema creation and modification, and database object access control management. ...


According to a different definition, a program is "declarative" if it is written in a purely functional programming language, logic programming language, or constraint programming language. The phrase "declarative language" is sometimes used to describe all such programming languages as a group, and to contrast them against imperative languages. Functional programming is a programming paradigm that conceives computation as the evaluation of mathematical functions and avoids state and mutable data. ... Logic programming (which might better be called logical programming by analogy with mathematical programming and linear programming) is, in its broadest sense, the use of mathematical logic for computer programming. ... Constraint programming is a programming paradigm where relations between variables can be stated in the form of constraints. ...


These two definitions overlap somewhat. In particular, constraint programming and, to a lesser degree, logic programming, focus on describing the properties of the desired solution (the what), leaving unspecified the actual algorithm that should be used to find that solution (the how). However, most logic and constraint languages are able to describe algorithms and implementation details, so they are not strictly declarative by the first definition.


Similarly, it is possible to write programs in a declarative style even in an imperative programming language. This is usually done by encapsulating non-declarative details inside a library or framework. An example of this style is the use of reflection in the JUnit unit test framework, which allows unit tests to be registered with the framework merely by being defined. Encapsulation may refer to: information hiding and separation of concerns, in software engineering, the process of enclosing programming elements inside larger, more abstract entities integrated circuit encapsulation, in electronics the design and manufacture of protective packages micro-encapsulation, means to confine material molecular encapsulation, means to confine molecules encapsulation (pharmacology... Insert non-formatted text here For the Egyptian goddess Junit, see Junit (goddess). ...


In a declarative program you write (declare) a data structure that is processed by a standard algorithm (for that language) to produce the desired result.


A declarative language, like all languages, has a syntax describing how the words in the language may be combined, and a semantics describing how sentences in the language correspond to a program's output.

Contents

Domain-specific languages

One popular form of declarative programming is its use in domain-specific languages (DSLs). "Domain" in this case refers to the "domain of discourse" — the subject matter that the language is intended to describe. Examples of DSLs are configuration files, spreadsheets, and even email (the "From:" and "To:" headers can be seen as processing instructions). In computing, configuration files, or config files, are used to configure the initial settings for some computer programs. ... A spreadsheet is a rectangular table (or grid) of information, often financial information. ... In information technology, Header refers to supplemental data placed at the beginning of a block of data being stored or transmitted, which contain information for the handling of the data block. ...


One drawback of DSLs is that they are often not Turing-complete. That is, there are certain things they cannot do. Just as you cannot use a spreadsheet to send e-mail, you cannot use e-mail to calculate your bank balance. For this reason, DSLs are sometimes embedded inside a general-purpose programming language. This allows a programmer to use the DSL for problems that play to its strengths, and use the general purpose language for problems that are difficult or impossible in the DSL. In computability theory a programming language or any other logical system is called Turing-complete if it has a computational power equivalent to a universal Turing machine. ...


Stand-alone DSLs — those not embedded in a general purpose language — are often easier to use than an embedded equivalent, since they avoid the added conceptual complexity imposed by the general purpose language.


Examples

Category:Declarative programming languages tries to provide an exhaustive list.

Frameworks whose deployment has declarative programming aspects:

Domain-specific languages that support declarative programming: Insert non-formatted text here For the Egyptian goddess Junit, see Junit (goddess). ...

  • XSLT is a declarative language for transforming XML documents
  • SQL has a declarative part for relational database queries
  • TK Solver
  • XForms is an XML format for the specification of a data processing model for XML data and user interface(s) for the XML data, such as web forms.

Functional/logic/constraint programming languages that support declarative programming: ... The Extensible Markup Language (XML) is a general-purpose markup language. ... SQL (IPA: or IPA: ), commonly expanded as Structured Query Language, is a computer language designed for the retrieval and management of data in relational database management systems, database schema creation and modification, and database object access control management. ... TK Solver is mathematical modeling and problem solving software featuring a declarative, rule-based language. ... XForms is two things: 1. ... The Extensible Markup Language (XML) is a general-purpose markup language. ... The user interface is the part of a system exposed to users. ... A webform on a web page allows a user to enter data that is, typically, sent to a server for processing and to mimic the usage of paper forms. ...

Erlang is a general-purpose concurrent programming language and runtime system. ... Haskell is a standardized purely functional programming language with non-strict semantics, named after the logician Haskell Curry. ... Lisp is a family of computer programming languages with a long history and a distinctive fully-parenthesized syntax. ... Prolog is a logic programming language. ... Mercury is a functional logic programming language based on Prolog, but more geared towards practical applications. ... Oz is a multi-paradigm programming language. ...

See also

A declarative programming language is a high-level language that describes a problem rather than defining a solution — it makes use of declarative programming. ... Computer programming (often shortened to programming or coding) is the process of writing, testing, and maintaining the source code of computer programs. ... A programming paradigm is a paradigmatic style of programming (compare with a methodology, which is a paradigmatic style of doing software engineering). ... In computer science, imperative programming, as opposed to declarative programming, is a programming paradigm that describes computation in terms of a program state and statements that change the program state. ... This does not adequately cite its references or sources. ... Business rules describe the operations, definitions and constraints that apply to an organization in achieving its goals. ... A domain-specific programming language (domain-specific language, DSL) is a programming language designed to be useful for a specific set of tasks. ...

References

  • Declarative language in The Free On-line Dictionary of Computing, Editor Denis Howe.
  • Relational language in The Free On-line Dictionary of Computing, Editor Denis Howe.
  • Logic programming in The Free On-line Dictionary of Computing, Editor Denis Howe.
  • Functional programming in The Free On-line Dictionary of Computing, Editor Denis Howe.

External links


  Results from FactBites:
 
Declarative Web Programming | Website Design | Web Site Company (273 words)
Declarative programming is a term with two distinct meanings, both of which are in current use.
In a declarative program you write (declare) a data structure that is processed by a standard algorithm (for that language) to produce the desired result.
A declarative language, like all languages, has a syntax describing how the words in the language may be combined, and a semantics describing how sentences in the language correspond to a program's output.
Declarative programming - Wikipedia, the free encyclopedia (710 words)
Declarative programming is a term with two distinct meanings, both of which are in current use.
According to a different definition, a program is "declarative" if it is written in a purely functional programming language, logic programming language, or constraint programming language.
In a declarative program you write (declare) a data structure that is processed by a standard algorithm (for that language) to produce the desired result.
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.