Learn something new every day
More Info... by email
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.
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.
One of our editors will review your suggestion and make changes if warranted. Note that depending on the number of suggestions we receive, this can take anywhere from a few hours to a few days. Thank you for helping to improve wiseGEEK!