Category: 

What is Imperative Programming?

Article Details
  • Written By: Victoria Blackburn
  • Edited By: Bronwyn Harris
  • Last Modified Date: 01 November 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
The mongoose was introduced to Hawaii in order to kill rats, but mongooses hunt in the day, while rats are nocturnal.  more...

December 7 ,  1941 :  Japanese bombers attack Pearl Harbor.  more...

Imperative programming is a method used by computer programmers. The statements that are used in this type of programming give commands to the computer for actions that are to be followed. This is the opposite of declarative programming, which is used to tell the computer what needs to be done without giving details of how the actions are to be taken.

Imperative programming was so named based on imperative mood used in natural languages versus constructed languages, such as computer programming languages. During communication, the imperative tense is used to give a direct command to someone. These commands usually demand a particular action from the audience receiving the message. The command – action result of imperative mood is the same way that this type of programming works with computers.

In some cases, this method of programming is also referred to as procedural programming. Procedural programming refers to the fact that this type of computer programming provides procedures for computers to follow so that a program can be built and run. Procedures are also referred to as subroutines or functions.

Ad

From as early as the 1950s, imperative programming has been used. FORTRAN is one of the earliest examples of an imperative programming language. By developing FORTRAN as well as more complex versions of this type of programming, computer programmers were able create much more intricate programs compared to what they were initially able to do using only the machine code of the computer being worked on. This in turn has allowed computers to evolve so they are able to create and run much more advanced applications.

Over time, imperative programming languages have become more and more sophisticated. Variables, expressions, functions and sub-programs are all now a part of a program written using imperative programming. Modern languages include those that follow object-oriented programming. Object-oriented programming uses objects to design and compile computer programs and applications. An object is anything that can be manipulated by running a computer program, which include variables, functions, values and data structures.

Declarative programming is the opposite way of programming from imperative. When computer programmers use declarative programming, they are describing what they want to happen, or the desired results of running their program. Although the results are given, the process to reach those alerts is not. The fact that step-by-step procedures are not provided is the key difference between declarative programming and imperative programming.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

Post Anonymously

Login

username
password
forgot password?

Register

username
password
confirm
email