0

Procedural Paradigm according to Wikipedia:

Procedural programming is a programming paradigm, derived from structured programming, based on the concept of the procedure call. Procedures, also known as routines, subroutines, or functions, simply contain a series of computational steps to be carried out. Any given procedure might be called at any point during a program's execution, including by other procedures or itself.

Structured Paradigm According to Wikipedia:

Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by making extensive use of the structured control flow constructs of selection (if/then/else) and repetition (while and for), block structures, and subroutines.


Both of those definition are similar. I can't find a difference between the two definitions.

Both of them have:

  1. procedures that can be called.
  2. control structure, to alter control flow

Is it enough to base their difference on: procedural can call other functions within a function including itself while structured can only call a function from the main function?

What exactly differentiates these two paradigms?

  • I'm not sure about this, but I think that structured programming was initially more of a discipline - once it became clear that it is possible to express any computation using structured programming constructs, early adopters begin coding in that way, and applying it even where the paradigm wasn't supported by the language (by, say, rolling their own constructs for assembly code), and then languages appeared with support for it. – Filip Milovanović Dec 1 at 23:24
  • Procedural is about having the ability to call procedures. In high-level languages, there's what's I've seen referred to as the "procedure abstraction" - you make the call, and a new stack frame is created with the return address, args, and local variables (the usual stuff we all take for granted). But this only works because the compiler generates code that does this for you; in assembly, you'd have to do this manually. So procedural should be about supporting this idea & programming in those terms. Most languages support both. – Filip Milovanović Dec 1 at 23:24
  • See, for example, history of Fortran here; the first release had support for a couple of different IF statements, & for DO (loops), but support for user-defined procedures only appeared in version 2, that introduced the SUBROUTINE, FUNCTION, CALL and RETURN statements. – Filip Milovanović Dec 1 at 23:34
2

These two terms are addressing different though related concepts.

Both seek to improve lessor programming paradigms by increasing the separation of concerns between program constructs, compartmentalization of components, organization of code.

Let's also note that that in the Wikipedia article, the assertion that procedural programming derived from structured programming needs a citation.  And as @MartinMatt says, the term is usually used in opposition to OOP, which has additional constructs for organization & abstraction.


Structured means block structuring, such as if-then-else, while, for, etc..  Using these eliminates goto's and labels, and make programs more readable and less error prone.  (Naming labels is a chore that is error prone.)  Blocks also nicely nest.

Procedural programming means using functions & procedures to compartmentalize and name operations rather than repeating lines of code.

2

To put it simply, imperative programming can be structured or unstructured. Structured programming can be procedural or object-oriented.

So procedural is a subset of structured and the term is usually used to contrast with object-oriented.

Java would be an example of a language which is structured but not procedural (since it is object-oriented).

The terms "structured" and "unstructured" are not used that much anymore, since unstructured programming is very rare outside of assembler. The oldest versions of BASIC and FORTRAN was unstructured, but later versions got support for structured programming.

0

The term procedural is often used as the counter term to object oriented. Like things were done in the old days, before we had languages that supported object orientation. That is procedural.

Structured is the counter term of making a mess of your code, that is programming in such a way that program flow is obscured somehow and the logic is hard to read.

You can be both structured and procedural at the same time. Code in methods within classes can be either structured or not.

  • From your answer, you're saying there's no difference between structured and procedural. The paradigm name is just there for comparison between old way and new way of doing things. Is that correct? – EdgeDev Dec 1 at 19:08
  • @EdgeDev It is a matter of emphasizing different traits. Your question is like asking for the difference between an oil painting and figurative art. With the first one you express you use oil paint as a material. With the seconds you are saying you are not talking about music or dance and that the image represents something from the real world. The two are not mutually exclusive. – Martin Maat Dec 1 at 19:31
0

If you read the Wikipedia articles in full, you see that the basic elements of structured programming are

  • sequencing

  • selection, and

  • repetition.

So at this point, "procedures" are not a necessary element for the structured programming paradigm.

Said that, subroutines and procedures are usually seen as optional elements of structured programming as well, and that is where in my understanding the Procedural Paradigm begins. This paradigm relies on those things called "procedures" which have input parameters and return values, blocks, and (at least most often) the notion of scope with local variables.

Any procedural programming language I have seen over the last 3 decades supports also all the elements of structured programming as well. As the Wikipedia article about Procedural programming says, this paradigm was derived from the former, hence it can be seen as an extension of structured programming.

Of course, the lines are a bit blurry and those terms are definitely not mutually exclusive.

  • Thanks for your answer but after carefully reading en.wikipedia.org/wiki/Structured_programming Sub-routine/procedure is necessary part of structured programming. – EdgeDev Dec 1 at 20:44
  • 1
    @EdgeDev: It would be really great if you could clarify what, exactly, you're looking for, other than an argument. – Robert Harvey Dec 1 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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