Nonprocedural language: Difference between revisions

Content deleted Content added
No edit summary
Line 11:
 
Therefore, functional and procedural are for all practical purposes synonyms of one another. A procedural language is a functional language.
 
[[Category:Query languages]]
 
A computer language that does not require writing traditional programming logic. Also known as a "declarative language," users concentrate on defining the input and output rather than the program steps required in a procedural language such as C++ or Java. For example, a command, such as LIST, might display all the records in a file on screen, separating fields with a blank space. In a procedural language, all the logic for inputting each record, testing for end of file and formatting each column on screen has to be explicitly programmed.
 
Query languages, report writers, interactive database programs, spreadsheets and application generators are examples of non-procedural languages.
 
 
 
<big>'''Non-procedural Languages'''</big>
 
 
In non-procedural languages the computer is not limited to a set of precise instructions. Instead, the programmer defines only the problem--not the instructions--to solve the problem. The computer determines the necessary steps to solve the problem. In essence, non-procedural languages emphasize the result (or what) is to be achieved rather than the methods (or how) a result is achieved. For example, to sort a list, the programmer instructs the computer to output a list in which adjacent items are in increasing or decreasing order.
 
The term non-procedural is relative in that it changes as languages continue to evolve. What may have been considered non-procedural 40 years ago may be procedural today because computer hardware and programming capabilities have improved. Additionally, most non-procedural programming languages cannot be defined purely as such; many have features of both procedural languages as well.
 
There are two major classes of non-procedural languages: functional and logic languages. Functional languages apply functions to given parameters. Functions are statements that return a single value based on the arguments, or inputs, it is passed. Functional programs attempt to act like mathematical functions. They are harder to implement efficiently than procedural languages. Until computers are designed on which functional languages can execute more efficiently, they will not replace procedural languages. Examples of functional languages are LISP and Miranda.
 
In logic languages, the programmer defines the problems through declarations or facts. Declarations are propositions that can be written in symbolic logic or as "if-then" statements. For example, if X is the mother of Y then X is a parent of Y. Given inputs, the computer determines if the declarations are true. Logic languages have the potential to be powerful and flexible. However, they are not as efficient as other languages, and methods for solving large problems this way still need to be developed. Prolog is the best known logic language.
 
 
 
<big>'''Advantages and Disadvantages of Non-procedural Languages'''</big>
 
 
Much of the onus for designing a step-by-step procedure for solving a problem is taken on by the computer. Programming in a non-procedural language allows the programmer to concentrate on understanding and describing the problem, while the computer does the work of figuring out how to solve the problem. A disadvantage of this type of language is that efficiency can suffer. The computer may not select the "best" method for solving the problem, resulting in the computer taking longer to solve it then if the programmer had provided it with a set of explicit instructions. Good methods that allow non-procedural languages to solve large problems efficiently are yet to be developed.
 
 
==Notes and references==
{{reflist}}
 
(1) http://encyclopedia2.thefreedictionary.com/non-procedural+language
[[Category:Query languages]]
 
 
(2) http://www.bookrags.com/research/programming-languages-types-wcs/
{{Compu-lang-stub}}