By researching around (books, Wikipedia, similar questions on SE, etc) I came to understand that Imperative programming is one of the major programming paradigms, where you describe a series of commands (or statements) for the computer to execute (so you pretty much order it to take specific actions, hence the name "imperative"). So far so good.

Procedural programming, on the other hand, is a specific type (or subset) of Imperative programming, where you use procedures (i.e., functions) to describe the commands the computer should perform.

First question: Is there an Imperative programming language which is not procedural? In other words, can you have Imperative programming without procedures?

Update: This first question seems to be answered. A language CAN be imperative without being procedural or structured. An example is pure Assembly language.

Then you also have Structured programming, which seems to be another type (or subset) of Imperative programming, which emerged to remove the reliance on the GOTO statement.

Second question: What is the difference between procedural and structured programming? Can you have one without the other, and vice-versa? Can we say procedural programming is a subset of structured programming, as in the image?

enter image description here


Many of the terms can be reused (often misused) about programming languages, especially those other than object oriented ones.

Here are some small descriptions of the terms.

  1. Imperative programming - In good old days, when programming was broadly in assembly, code would have tons of GOTOs. Even higher level languages like FORTRAN and BASIC began using the same primitives. In this programming paradigm, the entire program is a single algorithm or complete functionality written linearly - step-by-step. This is imperative style. Understand that one can really write totally bad imperative work even in modern C language as well but it is quite easy to organize code in higher level languages.

  2. Structured and Modular programming - Most often we should be able to use the term interchangeably but with subtle differences. When higher level languages begun to get richer, one realized that all units of work should be broken into smaller tractable parts - that is when functions came into existence and programming became a hierarchy of functions and many at lower level could be re-used.

    • Structured programming is any programming when functionality is divided into units like for loop, while loop, if... then etc block structure.
    • Also, here the a piece of code (function) can be re-used.
    • In modular programming, one can create a physical form of package - i.e. a chunk of code that can be shipped; which are fairly general purpose and re-usable. This is called modules of elements compiled together.
    • So one can hardly see modular programs which are not structured and vice versa; the technical definition is subtly different but mostly structured code can be made modular and other way.
  3. Then came "object oriented programming" which is well defined in literature. Understand that object oriented programming is a form of structured programming by definition. The new name for all those function based code which is structured code but NOT object oriented is often called as Procedural programming.

    • So basically structured code where functions (or procedures) dominate over data is called procedural whereas class and object based representation is called object oriented. Both by definition are also modular.

Many people think - all of structured programming (maybe skipping Object based) as imperative programming; I guess this is only due to lack of clear definition of imperative programming - but it is wrong. You are doing structured programming when you are not doing much imperative ones! But I can still write a lot of functions as well as a lot of goto statements inside C or FORTRAN program to mixup.

To be specific to your questions:

First Question : Pure assembly language is imperative language which is NOT structured or procedural. (Having step by step interpretive control flow doesn't mean procedural - but division of functionality into functions is what makes a language procedural).

  • correction * Most modern forms of assembly DO support the use of functions. In fact, everything that's possible in high level code HAS to exist low level to work. it's both possible to write procedural and imperative, but however, it's far better practice to create procedural code. Unlike the latter, it's maintainable and easier to understand (avoiding horrible spaghetti code). I think there are shell/bash scripts that better fit the accolade of being purely imperative, but even then, most have functions, developers definitely understand how much value they have.

Second Question : Procedural programming is a FORM of structured programming.


  • 1
    So would you say that procedural programming necessarily is also structured programming, while the opposite is not true (though often the case)? – Daniel Scocco Oct 31 '11 at 18:33
  • 2
    Yes, i would say so. – Dipan Mehta Nov 1 '11 at 3:10
  • 1
    In my answer i have defined imperative vs. structured - where imperative programming is written with just step-by-step execution and is not structured. However, according to some definition there is another classification; this is a classification between Declarative (or functional language) vs. Imperative. Declarative languages allow computation without describing its control flow where as imperative is where explicit control flow (step-by-step) is defined. Based on this classification, Imperative programing, for some can be a super-set of structured. Some don't quite follow that definition. – Dipan Mehta Nov 1 '11 at 3:14
  • I have a different opinion, with regards to the definition of structured programming. Structured Programming and Modular Programming are not the same thing. Please see the definition at the end of this note. The same link suggests that Assembler ** is a ** structured programming language! Reference for definition of STP:en.wikipedia.org/wiki/Structured_programming – Emmad Kareem – NoChance Jan 17 '12 at 5:43
  • Is a "physical form of package"... a file, or a directory/archive of files? (Or is it not, and it's something else.) – n611x007 Jun 23 '12 at 18:50

First question: Yes, many pure object-oriented languages qualify. While they have methods, which are very close to functions, they view these methods in terms of messages and do not give them enough weight to call the language procedural.

Second question: The difference is often in a different scope. You can have a function with goto statements all over the place, which will be in procedural style, but not structured programming. On the other hand, most OO languages support and encouraged structured programming, but not procedural programming.

Procedural programming describes the global ordering of the program. Procedural programs are those that are most effectively understood by looking at their call graphs. Structural programming is a local property, it applies to the use of if and while as opposed to goto.

As such, these two properties are disjunct, you can have either one without the other.

  • The only litmus test for being Procedural is that the language contain procedures (function or methods) and be Imperative, ie. non-Declarative. This means most OO languages that are not pure functional would be Procedural. – dietbuddha Oct 31 '11 at 16:15
  • @dietbuddha: By this definition, Haskell would qualify as a procedural language via its use of monads. I'd require a certain deal of reliance on procedures to make a language procedural. – thiton Oct 31 '11 at 16:23
  • I don't know Haskell that well, but I thought Haskell is a pure functional language because it wraps side effects in Monads. – dietbuddha Oct 31 '11 at 17:27
  • 2
    Well, some people claim Haskell is not purely functional because it allows any interaction with the outside world (or because a GHC extension, unsafePerformIO allows wreaking havok). Others joke that Haskell is their favourite imperative programming language. But fact is, a very large degree of Haskell code lives cleanly seperated from IO, doesn't use nonstandard loopholes to sneak side effects in, and is purely functional. – user7043 Oct 31 '11 at 17:53
  • 1
    @thiton I disagree. Monads are functional constructs too; they only look imperative due to Haskell's syntax sugar (the "do notation"). When you desugar monads, their functional nature becomes evident. In contrast, OO languages are indeed imperative: at their core they are based on the sequential execution of statements. – Andres F. Nov 16 '12 at 16:47

most of the popular languages of the past 50 years have been designed around the prevalent computer architecture, called the Von Neumann architecture, after one of its originators, John von Neumann.

These languages are called imperative languages.

In a von Neumaan computer, both data and programs are stored in the same memory. The CPU which executes instructions is separate from the memory. Therefore instructions and data must be transmitted from memory to CPU. Results of operations in the CPU must be moved back to memory. Nearly all digital computers built since 1940s have based on von Neumaan architecture.

  • 1
    +1 not sure what this has to do with the question, but it's an interesting answer. – Chuck Conway Nov 16 '12 at 17:04
  • 2
    What? Where's the part about Imperative vs Procedural, etc? – bbqchickenrobot Mar 8 '15 at 16:50

protected by gnat Jun 5 '17 at 11:14

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.