DEV Community

Matheus Gomes πŸ‘¨β€πŸ’»
Matheus Gomes πŸ‘¨β€πŸ’»

Posted on

Programming Paradigms: Structured

Sup dudes, it's me again!😎

Now to talk about programming paradigm, this time about the STRUCTURED programming paradigm.

If you are new to this article, i explain everything about the basics of programming in my previous article, this is a series of articles about this topic. Every time i learn about one i come here and write another one.

Here you can get to all of my articles of this series!

Programming paradigm #1
You are here!

So...

What is a Structured Programming Paradigm?πŸ€”

More Technical ExplanationπŸ‘¨β€πŸ’»:

According to Ray Toal (see references) structured programming paradigm is defined by a Programming with clean, goto-free, nested control structures.

What does it mean? It means that structured programming is a kind of imperative programming where control flow is defined by nested loops, conditionals, and subroutines, rather than via GOTOS. Variables are generally local to blocks (have lexical scope).

Early languages emphasizing structured programming: Algol 60, PL/I, Algol 68, Pascal, C, Ada 83, Modula, Modula-2. Structured programming as a discipline is sometimes though to have been started by a famous letter by Edsger Dijkstra entitled Go to Statement Considered Harmful.

More practical explanationπŸ˜‹:

It's simple a advance or improvement on 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.

Graphical representation of the three basic patterns β€” sequence, selection, and repetition β€” using NS diagrams (blue) and flow charts (green).

Practical example:

result = [];
for i = 0; i < length(people); i++ {
    p = people[i];
    if length(p.name)) > 5 {
        addToList(result, toUpper(p.name));
    }
}
return sort(result);
Enter fullscreen mode Exit fullscreen mode

In shortπŸ‘

It's a advance in the early programming languages by using if/else/while/for and block structures and subroutines.

Imagine programming in something the doesn't even have a if else statement, that was a reality a few years ago in the early beginnings of programming. That's why we need to be thankfully to Dijkstra and his hate to GOTO statements.

References:

https://cs.lmu.edu/~ray/notes/paradigms/

https://en.wikipedia.org/wiki/Structured_programming

https://en.wikipedia.org/wiki/Goto#Criticism

https://cs.lmu.edu/~ray/

Latest comments (2)

Collapse
 
wakeupmh profile image
Marcos Henrique

Awesome 🀘

Collapse
 
matheusgomes062 profile image
Matheus Gomes πŸ‘¨β€πŸ’»

Thanks Marcos!