answersLogoWhite

0


Best Answer

Imperative versus Declarative Programming

Assuming that the reader has an intuitive understanding of what an imperative

(or procedural) program is, we approach the topic from the declarative angle.

According to Lloyd "declarative programming involves stating what is to be

computed, but not necessarily how it is to be computed"[32]. Equivalently, in the

terminology of Kowalski's equation [33] 'algorithm = logic + control', it involves

stating the logic of an algorithm (i.e. the knowledge to be used in problem

solving), but not necessarily the control (i.e. the problem-solving strategies).

While the logic component determines the meaning of an algorithm, the control

component only affects its efficiency [33].

Roy and Haridi [34] suggest to use the concept of a state for defining the line

between the two approaches more precisely. Declarative programming is often

referred to as stateless programming as an evaluation works on partial data struc-

tures. In contrast to that, imperative programming is characterized as stateful

programming [34]: a component's result not only depends on its arguments, but

also on an internal parameter, which is called its "state". A state is a collection of

values being intermediate results of a desired computation (at a specific point in

time). Roy and Haridi [34] differentiate between implicit (declarative) state and

5

explicit state. Implicit states only exist in the mind of the programmer without

requiring any support from the computation model. An explicit state in a pro-

cedure, in turn, is a state whose lifetime extends over more than one procedure

call without being present in the procedure's arguments. Explicit state is visible

in both the program and the computation model.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

AnswerBot

2w ago

In declarative programming, you specify what you want to achieve without explicitly providing the steps to reach that goal, while in imperative programming, you provide step-by-step instructions on how to achieve the desired outcome. Declarative languages focus on the "what" whereas imperative languages focus on the "how".

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between declarative and imperative language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Linguistics

What is the difference between a declarative and imperative?

Declarative programming focuses on describing the desired results without specifying how to achieve them, while imperative programming involves providing specific step-by-step instructions on how to achieve a result. Declarative programming is more concerned with what needs to be done, while imperative programming is more concerned with how it should be done.


What is the difference between a declarative sentence and an imperative sentence?

A declarative sentence makes a statement or provides information, while an imperative sentence gives a command or instruction. Declarative sentences usually end with a period, while imperative sentences often end with a period or exclamation mark.


What is the difference between horative and imperative sentences?

Horative sentences are used to express a wish, desire, or advice, while imperative sentences are used to give a direct command or instruction. In horative sentences, the speaker is usually expressing their own opinion or emotion, while imperative sentences are more focused on telling someone what to do.


What is the difference between interrogative and imperative?

Interrogative sentences are used to ask questions, seeking information or clarification. They typically begin with words like "who," "what," "where," "when," "why," or "how." Imperative sentences are commands or requests that tell someone to do something and usually do not have a subject, such as "please sit down" or "close the door."


What is the difference between exclamatory and imperative sentences?

Imperative sentences are sentences that gives command and requests while exclamatory sentences are those that expresses emotions and ends with an exclamation point.

Related questions

What is the difference between a declarative and imperative?

Declarative programming focuses on describing the desired results without specifying how to achieve them, while imperative programming involves providing specific step-by-step instructions on how to achieve a result. Declarative programming is more concerned with what needs to be done, while imperative programming is more concerned with how it should be done.


What is the difference between declarative and imperative programming?

Imperative is how the computer should do something. Declarative is what you would like the computer to do.


What is the difference between a declarative statement and an imperative statement?

In a declarative statement, you initialize the object. But in an imperative statement, you use a preexisting statement and use it.


What is the difference between a declarative sentence and an imperative sentence?

A declarative sentence makes a statement or provides information, while an imperative sentence gives a command or instruction. Declarative sentences usually end with a period, while imperative sentences often end with a period or exclamation mark.


What is difference between imperative and declarative sentences?

With an imperative sentence, the subject is understood and not necessarily stated. "Close the door." The subject is you and the verb is close.


What is the difference between Imperative object-oriented functional and logic programming?

These are all programming paradigms; they describe the "style" used to build the structure and elements of a computer program. Imperative programming is typically contrasted with declarative programming because they are mutually-exclusive (you won't find any programming languages that are both imperative and declarative), in the same way that you won't find any languages that have both a structured paradigm and a non-structured paradigm. The main difference between the two is that imperative programming describes how a result is to be achieved without specifying what is to be achieved, whereas declarative programming describes what is to be achieved without specifying how it is to be achieved. Another key difference is that imperative programming makes extensive use of changing-state and mutable data whereas declarative programming does not. Put simply, there are no assignment operations or side-effects in declarative programming. Given that the object-oriented programming (OOP) paradigm is based upon objects with member methods that can mutate the object's attributes, OOP is based upon the imperative paradigm. The functional programming paradigm is not to be confused with function calls which are based upon the procedural programming paradigm, which is itself based upon the structured programming paradigm, both of which are imperative. By "functional" we really mean mathematical functions, which are declarative. Although there are some imperative languages that do allow a type of functional programming style, at best they are a grey area because of the side-effects. Logical programming is also declarative and is based on relations.


What is the difference between declarative interrogative exclamatory and imperative sentences?

A declarative sentence states a fact or description about something. (e.g. The ball is red.) An interrogative sentence is a question. (e.g. What color is the ball?) An exclamatory sentence uses expression or voice to present information. (e.g. I'm so excited you are coming.) An imperative sentence issues a command. (e.g. Go get the ball. Don't run in the hallway.)


What is the difference between declarative and procedural questions?

procedural asks you to solve.


What is the difference between imperative and non-imperative programming languages?

Imperative languages focus on how the program should follow it's tasks, while non-imperative languages, functional or logical, tell the program what it needs to do, as opposed on how to do it.Imperative programming is programming which changes the computer's state and focuses on how a program is to perform. Non-imperative languages are predominantly declarative languages, where the programmer states what is to be performed without specifying how to achieve it.


What is the difference between exclamatory and declarative?

exclamatory ends with a ! and declarative just ends with a . just think of the word declarative as you are declaring something therefor you need a period to it to make sure you make your point (.)


What is the difference between a procedural language and declarative language?

Procedural is nothing but just using procedures to instrct te machine. The procedures provides a level of abstraction here. Declarative means to program without specifying the steps involved clearly. It allows us not give the control flow. ex - SQL is declarative as it does not need the control flow to be implemented. SQL is also procedural as it works on procedure names that are predefined.


What is the difference between QBE and SQL?

Query by Example (QBE) is a database query language for relational databases. A QBE parser parses the search query and looks for the keywords. A more formal query string, in languages such as SQL, is then generated, which is finally executed. However, when compared with a formal query, the results in the QBE system will be more variable.SQL (Structured Query Language) SQL is a set-based, declarative query language, not an imperative language such as C or BASIC. However, there are extensions to Standard SQL which add procedural programming language functionality, such as control-of-flow constructs