Declarative Languages

Difference between Compiled Language Vs Interpreted Language Vs Declarative Language

Compiled Language

A compiled language is a programming language where the source code is translated into machine code and the machine code is stored in a separate file. In this language, compilation errors prevent the code from compiling.

The code of compiled language can be executed directly by the computer’s CPU. This language delivers better performance.
Some examples of compiled languages are C, C++, C#, CLEO, COBOL.

Interpreted Language

An interpreted language is one which is compiled and executed line-by-line at runtime, as opposed to requiring a compilation step which fully compiles the source code before execution.
The primary advantage of interpreted languages is the ability to run incomplete programs, which makes development more convenient. The primary disadvantage is that the language compiles during runtime, which degrades performance .
Interpreted languages often make for good scripting languages.

Declarative languages, also called nonprocedural or very high level, are programming languages in which (ideally) a program specifies what is to be done rather than how to do it. 

EXAMPLES OF DECLARAVTIVE LANGUAGES

The best-known declarative programming languages are:

  • Prolog
  • Lisp
  • Haskell
  • Miranda
  • Erlang
  • SQL

Pros and cons

AdvantagesDisadvantages
Short, efficient codeSometimes hard to understand for external people
Can be implemented using methods not yet known at the time of programmingBased on an unfamiliar conceptual model for people (solution state)
Easy optimization as implementation is controlled by an algorithmHard to take characteristics of individual applications into account during programming