A programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops.
Questions tagged [structured-programming]
14 questions
112
votes
4 answers
What's The Difference Between Imperative, Procedural and Structured Programming?
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…

Daniel Scocco
- 5,832
- 9
- 39
- 47
25
votes
7 answers
What were the Design Patterns of the procedural programming era?
Similar: How was programming done 20 years ago?
OOP is quite fashionable nowadays, having its roots in Simula 67 in the 1960s, and later made popular by Smalltalk and C++. We have DRY, SOLID, many books about design patterns in the object-oriented…

Vorac
- 7,073
- 7
- 38
- 58
23
votes
6 answers
Beginner: Why aren't operations contained within output commands?
I'm going through an introductory programming book and it lists a simple example in pseudocode:
Start
input myNumber
set myAnswer = myNumber * 2
output myAnswer
Stop
Why can't we omit creating another variable called myAnswer and just put…

user1475207
- 349
- 2
- 5
17
votes
6 answers
Foreach-loop with break/return vs. while-loop with explicit invariant and post-condition
This is the most popular way (it seems to me) of checking if a value is in an array:
for (int x : array)
{
if (x == value)
return true;
}
return false;
However, in a book I’ve read many years ago by, probably, Wirth or Dijkstra,…

Danila Piatov
- 289
- 2
- 8
8
votes
3 answers
Why was GOTO included in PHP 5?
I discovered some time ago that the GOTO control keyword was introduced in PHP 5.3.0.
http://php.net/manual/en/control-structures.goto.php
Why did it happen?
What are the language design goals behind this?
Did the PHP developers community asked…

Tulains Córdova
- 39,201
- 12
- 97
- 154
6
votes
2 answers
Is Lisp the first language to adopt structured programming?
I couldn't find any links or books claiming that Lisp is the first programming language to adopt structured programming (actually, most of them don't even mention Lisp at all), but if conditionals were invented by McCarthy and got into Algol later,…

alice
- 187
- 4
5
votes
2 answers
Lua and multi-paradigm programming: scope and capabilities
Despite having started learning programming with Pascal and C, after the jump to OO (C++, Java) I lost sense of the structured programming paradigm. I have started learning Lua and I have researched many tutorials, but all of them only cover basic…

MLProgrammer-CiM
- 333
- 2
- 13
3
votes
1 answer
How do I distinguish between a "GOTO" version of an IF block and a "Structured" version of an IF block?
So I came across an old blog post from Robert Martin (Uncle Bob) that talks about how the Structured Programming discipline convinced programmers to take the GOTO statement out of their code, even when its only implicit like in this example that he…

BarrettNashville
- 171
- 5
3
votes
1 answer
Aren't structured programming and object oriented programming complementary?
It seems there is a lot of discussion on the web about the differences between these two paradigms, and how OOP is somewhat better than structured programming.
But aren't they complementary? From my point of view one could organize his application…

Thomas C. G. de Vilhena
- 267
- 1
- 2
- 9
2
votes
3 answers
The recommended Way to exit a Loop
Occasionally - but recurringly - I face the following loop pattern problem:
CodeSnippet1
DO WHILE LoopCondition //LoopCondition depends on some pre-calculation from CodeSnippet1
CodeSnippet2 //CodeSnippet2 relies on LoopConditon=true
…

fjf2002
- 123
- 4
2
votes
5 answers
Should unit-tests be entirely self-contained?
As the title suggests my question is whether or not
unit-tests should be entirely self-contained or can
one rely on the results yielded by previous tests?
What I mean, in case that it isn't entirely clear,
is that if ones initial test sufficiently…
user117184
1
vote
2 answers
Structuring data to represent a tree with squirrels
What I want to represent
Let's assume I have several schemas of the following kind:
It is a tree on which positions of squirrels are represented by a blue dot. The number of bifurcations differ from one tree to another, the number of squirrels…

Remi.b
- 113
- 6
0
votes
3 answers
Roadblock-confused about structure of program
I'm new to programming, and I'm working in C. I know that this is structured programming but if I use blocks, say for local variables:
{
int i;
for(i=0; i<25; i++){
printf("testing...\n");
}
}
Doesnt this make it kind of object…

tapiwa 'tp'
- 1
- 3
-1
votes
1 answer
Proper program structuring in Python
So, recently I have been doing a lot of programming in Python.
I have noticed that my programs can be somewhat hard to read. I usually have one main class which does everything, sort of like this:
class main:
def __init__(self, *args,…