+ 4

Is imperative programming the same as procedural programming?

Or is procedural just a subset of imperative?

16th Jun 2019, 12:49 AM
Sonic
Sonic - avatar
3 Réponses
+ 7
Sonic Imperative programming focuses on control flow and state with the explicit use of statements and operations. Statements can include assignment statements, looping statements, conditional statements, branching statements, etc. Operations include arithmetic, relational, bitwise, logical, assignment and other capabilities. Procedural programming is a subset of imperative programming emphasizing a concept known as procedures (a.k.a. routines, subroutines, functions). These procedures contain imperative statements which are isolated within a separate scope and can be called using a declared name. The alternative to procedure calls would involve goto statements and jump tables.
16th Jun 2019, 2:36 AM
David Carroll
David Carroll - avatar
+ 13
Procedural programming is a type of imperative programming in which the program is built from one or more procedures (also termed subroutines or functions). ... The concepts behind object-oriented programming attempt to extend this approach. Procedural programming could be considered a step towards declarativeprogramming.
16th Jun 2019, 12:56 AM
Assassin💞[#BeFierce]
Assassin💞[#BeFierce] - avatar
+ 3
Assassin Your response is generally correct except for the last part stating that "procedural programming could be considered a step towards declarative programming." This is presented in the context that OOP extends the concepts of subroutines or functions in procedural programming (PP). I don't believe the existence is OOP makes PP less imperative or more declarative.
16th Jun 2019, 2:29 AM
David Carroll
David Carroll - avatar