Log in Sign up
Back to Discover
💻

Imperative programming

technology Maturity 7-9

A computer needs help to work.

Computer-memory-map.png
Computer-memory-map.png
You give it a list of steps. It follows each step one by one. This is like a recipe for food. It tells the computer what to do. Do you like following steps?
Computer-memory-map.png
Computer-memory-map.png

41 words

A computer needs a list of steps to work.

Computer-memory-map.png
Computer-memory-map.png
These steps are like a recipe for food. They tell the computer exactly what to do.

One way to do this is by giving commands. The computer follows each command one by one. It changes things as it goes.

Some steps can repeat. This is called a loop. A loop tells the computer to do a task many times.

Other steps can skip parts. The computer only does a task if something is true. This helps the computer make choices.

Most computer languages work this way. It is a very common way to build software.

Computer-memory-map.png
Computer-memory-map.png

106 words

Computers need a list of steps to work. This way of giving orders is called imperative programming. It is like a recipe or a checklist. You give the computer a set of commands. The computer follows these commands one by one.

Computer-memory-map.png
Computer-memory-map.png

As the computer works, it changes things. It uses memory to store information. This information is called the state. One way to change the state is with an assignment statement. This tells the computer to save a result in memory.

Computer-memory-map.png
Computer-memory-map.png

Programs also use special tools to manage steps. A loop lets the computer repeat a task many times. A conditional statement lets the computer make a choice. It only does a task if a certain condition is met. Some programs use procedures. These are small parts that do one specific job.

Many famous languages use this style. Fortran was made for math in 1954. COBOL was made to look like English. C is a very important language used to build systems. Most computers today still use this way to run software.

174 words

Computers need clear instructions to do anything useful. One way to give these instructions is through imperative programming. This style uses commands to change the state of a process. You can think of the state as the current information held in the computer's memory.

Computer-memory-map.png
Computer-memory-map.png
In this way of working, the programmer describes exactly how a program operates step by step. This is different from declarative programming, which only describes the final result. Most computer hardware is designed to run this kind of imperative code. It is a very common way to build software today.

To make a program work, the computer follows specific tools. One tool is the assignment statement. This tells the computer to perform an operation and store the result in memory.

Computer-memory-map.png
Computer-memory-map.png
Another tool is the loop. A loop lets the computer repeat a sequence of steps many times. Sometimes it repeats a set number of times. Other times it repeats until a certain condition is met. There are also conditional branching statements. These allow the computer to skip certain steps unless a specific condition is true.
Computer-memory-map.png
Computer-memory-map.png

People have been developing these languages for a long time. In 1954, John Backus at IBM began working on Fortran. It was the first major language to help people write complex programs easily. Later, in the 1960s, experts created ALGOL to help express math ideas. In 1960, COBOL was developed to look more like English. Grace Hopper was a major contributor to COBOL's development. In the 1970s, Dennis Ritchie created the C language at Bell Laboratories.

Computer-memory-map.png
Computer-memory-map.png
These early steps helped shape how all modern computers work.

Many different types of imperative languages exist with unique features. Fortran was built for scientific calculations and math. COBOL was designed so that managers could read the code. BASIC was created at Dartmouth College in 1964 to help students learn.

Computer-memory-map.png
Computer-memory-map.png
In the 1970s, Niklaus Wirth developed Pascal. The United States Department of Defense also used a language called Ada. This language was designed by Jean Ichbiah and a team at Honeywell. They began the project in 1978 and published the rules in 1983. Each of these languages helped solve different problems for different people.

Imperative programming is a lot like following a recipe in a kitchen. Each instruction tells you exactly what to do next. If the recipe says "add salt," you are changing the state of the food.

Computer-memory-map.png
Computer-memory-map.png
A checklist is another great example of this style. You follow one task after another to finish a job. Even though computer code looks very different, it follows this same simple logic. It moves from one step to the next in a specific order. This makes it a very natural way for humans to talk to machines.

457 words

Imperative programming is a fundamental paradigm in computer science. It is a method of writing software using statements that change a process's state. In this context, the state refers to the current information held in the computer's memory.

Computer-memory-map.png
Computer-memory-map.png
This style is much like the imperative mood in natural languages, which uses direct commands. Instead of just describing a final result, an imperative program focuses on describing how to operate step by step. This is often contrasted with declarative programming. Declarative programming focuses on what a program should accomplish without detailing every specific step. Because the basic ideas of imperative programming are so close to how computer hardware actually works, it remains the most common model used to build software today.

To understand the mechanism, we must look at how these programs manipulate data. The core of this process involves assignment statements. These statements perform an operation on information in memory and then store the results back in memory for later use. High-level imperative languages also allow for the evaluation of complex expressions. These expressions combine arithmetic operations and function evaluations to produce a single value for assignment. To manage the flow of these instructions, programmers use several control structures. Looping statements, such as "while," "do while," or "for" loops, allow a sequence of instructions to repeat. A loop might run a predefined number of times or repeat until a specific condition is met. Conditional branching statements allow the computer to skip certain steps if a condition is not met. Unconditional branching, such as a "goto" or a procedure call, allows the execution to jump to a different part of the program.

Imperative programming can be organized into different types and levels of complexity. One major type is procedural programming. In this style, a program is built from one or more procedures, which are also called subroutines or functions. Procedural programming acts as a bridge toward declarative programming. A programmer can often understand what a procedure does just by looking at its name, its arguments, and its return types. Another important concept is structured programming. This involves heavy procedural programming, where state changes are localized to specific procedures. This makes programs easier to maintain and improves their overall quality. The concepts behind object-oriented programming attempt to extend these structured approaches even further.

History shows how these languages evolved from very simple beginnings. The earliest imperative languages were the machine languages used by original computers. These instructions were extremely simple, which made the hardware easier to build but made complex programming very difficult. A major turning point occurred in 1954 when John Backus at IBM began developing Fortran. Fortran was the first major high-level language to remove the obstacles of machine code. It introduced named variables, complex expressions, and subprograms. In the late 1950s and 1960s, the ALGOL language was developed to express mathematical algorithms more easily. During the same era, COBOL was created in 1960 to make programming syntax look more like English. Grace Hopper was a major contributor to the development of COBOL, which aimed to help managers read programs.

Specific languages were designed to meet very different needs throughout the 20th century. Fortran, unveiled in 1958 as "The IBM Mathematical FORmula TRANslating system," was built specifically for scientific calculations. It supported arrays and "do" loops but lacked string handling. BASIC, released in 1964 at Dartmouth College, was designed for students to learn programming. It pioneered the interactive session, allowing users to type commands like "new," "list," and "run" to manage their work. In the 1970s, Dennis Ritchie created the C language at Bell Laboratories to write the UNIX operating system. C is a small, powerful language that provides the facilities of assembly language with a high-level syntax. This allowed programmers to control exactly which regions of memory data should occupy.

As technology progressed, the focus shifted toward more advanced structures like object-oriented programming. This movement grew rapidly in the 1980s. Smalltalk-80 was released in 1980 by the Xerox Palo Alto Research Center, based on ideas from Alan Kay. Bjarne Stroustrup later designed C++, which was an object-oriented language based on C. He began this design in 1979, and the first implementation was completed in 1983. The late 1980s and 1990s saw a massive wave of new imperative languages that used object-oriented concepts. These include Perl, Python, PHP, Java, JavaScript, and Ruby. Even modern frameworks, such as Microsoft's .NET Framework, remain imperative at their core.

Understanding imperative programming helps us see the connection between human logic and machine execution. The way we follow a recipe in a kitchen is a perfect analogy. Each instruction tells us exactly what to do next, such as "add salt." By doing this, we are changing the state of the food. A process checklist works the same way, where each step is an instruction and the physical world holds the state. Because these concepts are so familiar to humans and so deeply embodied in computer hardware, the imperative style has become the standard language of the digital world.

834 words
🖼️ Images & Media (1)
File:Computer-memory-map.png
Computer-memory-map.png
Up Next
💻
Programming paradigm
Technology
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.