+13  A: 

Declarative programming is where you say what you want without having to say how to do it. With procedural programming, you have to specify exact steps to get the result.

For example, SQL is more declarative than procedural, because the queries don't specify steps to produce the result.

Ned Batchelder
Can you please tell me other type programming languages besides Declarative, Procedural and OOP. Thanks.
Braveyard
+1 for good example on SQL. can we have more examples please?
thephpdeveloper
Mauris: Maybe not a programming language, but HTML is declarative, because you describe what you want (a paragraph with *this bit* in bold), rather than writing out "draw string, measure string, advance position, etc." Another example is Prolog, where a "program" is a declarative set of facts and relations/deductions, and a query. The Prolog engine figures out how to evaluate the query: you don't need to tell it how to do so. Finally, regular expressions: you describe the pattern rather than spelling out the steps to test for a match.
itowlson
MXML (part of the Flex framework) is declarative: You tell it what order you want your objects/containers to be displayed, and it handles the layout depending on whether you've told it to lay itself out horizontally or vertically. ActionScript 3 is procedural with support for OOP paradigms.
Hooray Im Helping
makefiles is another quite famous declarative language
Stefano Borini
@guys above this comment - awesome examples given! now I have a better idea on Declarative programming =D
thephpdeveloper
+11  A: 

Declarative

Describe a result and get it via a black box. Examples:

  • yacc
  • Treetop
  • SQL
  • Regular Expressions
  • lex
  • XSLT
  • markup, troff, CSS, VHDL

Procedural

Describe the algorithm and process steps, at various degrees of abstraction.

  • C, most legacy languages
  • PHP, mostly
  • in some sense all major languages

Object Oriented

  • Tends to be in the procedural category, typically refers to languages that exhibit a hierarchy of types that inherit both methods and state from base types to derived types, but also kind of includes prototype-based languages like JavaScript. Somewhat a separate dimension from the other categories here.

Functional

You left this one out. The opposite of imperative programming, it emphasizes the application of functions without side effects and without mutable state. The declarative systems above exhibit certain aspects of functional programming.

  • Scheme
  • Erlang
  • OCaml
  • Haskell
  • Lisp, depending. (Lisp perhaps deserves its own unique category)
  • Clojure, somewhat
  • Ruby, somewhat less
  • F#
DigitalRoss
I'd add lisp to your list of functional programming languages.
dave
Wow, thanks for this nice answer.
Braveyard
You can also add logical languages like Prolog.
Gamecat
+1  A: 

Procedural Programming :

In procedural programming, when the program starts, it follows a set of instructions. The instructions may change based on some file or memory content, but overall, it doesn't vary widely. the input to the program is typically not from user input in real-time, but rather from a pre-gathered set of data.

Declarative Programming:

In Declarative Event driven programming centralizes around a body of data with optional actions the program can take on it. For example, each "event" in a word processor is any mouse or keyboard (or file) changes that affect the data, the document(s). They need not be performed in any order. Event driven programming takes the form of small programs (event handlers) that all work on a common set of data, so that each small program can use the same data, the document in this example.

SattiS