Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Does the structured programming definition only consider imperative programming? By this I mean does the definition of structured programming automatically exclude functional programming (in the most common usage, by which I mean not necessarily pure-functional programming, but something like Clojure).

Structured programming, at least from the definitions that I've found seem to really be saying: "good programming shouldn't use goto, and should be modular". Which doesn't necessarily exclude functional programming, while most definitions seem to begin with "... is a subset of imperative programming".

I'm looking for a bit of clarification I think.

BTW, I have read "What's The Difference Between Imperative, Procedural and Structured Programming?" which is a pretty good historical description.

share|improve this question

2 Answers 2

up vote 8 down vote accepted

Suppose that you use and create only pure functions. These by definition have no shared state and are easy to compose, and there's no way to use a goto. This satisfies both 'modularity' and 'structured control flow' properties.

What could it be? A map-reduce calculation. A Prolog inference. An SQL query (can be reused as a subquery or a view). Are you comfortable to put all these under the umbrella of the notion from 1960s?

To me, 'structured programming' is mostly a historical concept, connected to, for instance, 'Goto Considered Harmful' and other works of Dijkstra. It is deeply rooted in imperative world. You do structured programming when you write good C code. You do something different when you write highly modular, well-structured code in Haskell or probably even Scala.

share|improve this answer

Structured programming is essentially programming by composing procedures.

Can you do something similar with functions in a functional language? Yes.

When people talk about structured programming, do they usually mean to include functional programming? No.

If you say "structured programming style," will people understand you to be including functional programming? No.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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