Log in Sign up
Back to Discover
💻

Structured programming

technology Maturity 11-13

Computers use sets of rules.

Structured program patterns.svg
Structured program patterns.svg
These rules help them work. One rule tells them to go in order. One rule helps them choose. One rule lets them do things again. This makes the work easy to read. Do you like rules?

42 words

Computers follow sets of rules. These rules help them work.

Structured program patterns.svg
Structured program patterns.svg

Old rules could be messy. They were like tangly spaghetti. This made the work hard to read.

New rules make code better. One rule goes in order. One rule helps choose a path. One rule lets things repeat.

These rules help people understand code. It makes the work easy to change.

Most people use these rules today. It is a very smart way to work.

76 words

Computers follow sets of instructions to do work. These instructions are called code. In the past, code could be very messy. It was often called spaghetti code. This was because the instructions jumped around in a tangly way. This made the code hard to read and fix.

To solve this, people created structured programming. This is a way to write code using clear blocks.

Structured program patterns.svg
Structured program patterns.svg

There are three main ways to move through code. The first is a sequence. This means the computer follows steps in a straight line from top to bottom. The second is selection. This lets the computer choose a path based on a choice. The third is iteration. This is when the computer repeats a set of steps over and over.

Structured program patterns.svg
Structured program patterns.svg

A scientist named Edsger W. Dijkstra helped make this way of writing popular. He argued that jumping around with a command called "goto" was harmful. Today, almost all programmers use these structured ways to write code. It helps make software easy to understand and change.

171 words

Computers follow sets of instructions to perform tasks. These instructions are known as code. In the early days, code could become very messy. Programmers often used a command called "goto" to jump between different parts of the code. This created a tangled mess often called "spaghetti code." It was very hard for people to read or fix. Structured programming was created to solve this problem. It provides a cleaner way to organize how a computer moves through instructions.

Structured program patterns.svg
Structured program patterns.svg

Structured programming works using three main building blocks. The first is called a sequence. This means the computer follows steps in a straight line from top to bottom. The second is selection. This lets the computer choose a path based on a specific condition. It uses keywords like "if" or "else" to make these choices. The third is iteration, which is also called repetition. This allows a block of code to run over and over again. This happens until a certain goal is reached.

Structured program patterns.svg
Structured program patterns.svg

This way of writing code became popular in the late 1950s. It emerged alongside languages like ALGOL 58 and ALGOL 60. A Dutch scientist named Edsger W. Dijkstra helped lead the movement. He wrote a famous letter in 1968 called "Go To Statement Considered Harmful." He actually coined the term "structured programming" himself. In 1966, a paper by Böhm and Jacopini provided a mathematical proof for these ideas. This proof showed that these three structures could express any task a computer can do.

Structured program patterns.svg
Structured program patterns.svg

Many important people helped develop these ideas during the 1960s and 1970s. Scientists like Robert W. Floyd, Tony Hoare, and Ole-Johan Dahl all made contributions. Even famous programmers like Donald Knuth joined the discussion. Knuth believed code should be easy to prove as correct. However, he did not always agree with getting rid of the "goto" command entirely. In 1974, he wrote a paper about using "goto" in a structured way. He argued that sometimes a direct jump could actually make code clearer.

Structured program patterns.svg
Structured program patterns.svg

Today, structured programming is the standard way to write software. Most high-level languages like Python, C, and Pascal use these structures. Even older languages like FORTRAN and COBOL have added them over time. It is so common now that many people do not even think about it as a special topic. It makes code easier to understand and modify for everyone. Using these clear blocks helps prevent errors and keeps programs running smoothly. It turns a messy tangle of jumps into an organized path.

Structured program patterns.svg
Structured program patterns.svg

417 words

Structured programming is a specific way of organizing computer code. It uses a block-based structure to control the flow of instructions. This means the programmer decides the exact order in which the computer performs tasks. The main goal was to replace a command called "goto" with more organized tools. Without these tools, code often becomes a tangled mess known as "spaghetti code." This mess makes it very difficult for people to read or fix programs. Today, structured programming is so common that it is the standard way most software is written.

Structured program patterns.svg
Structured program patterns.svg

The core of this method relies on three specific control structures. The first is called a sequence. In a sequence, the computer executes statements in a strict, top-to-bottom order. The second is selection, which allows the program to choose between different paths. This is often done using "if-then-else" or "switch" statements based on a specific condition. The third is iteration, which is also called repetition. This allows a block of code to run repeatedly until a certain state is reached. Common keywords for this include "for" and "while."

Structured program patterns.svg
Structured program patterns.svg

These three structures are not just convenient; they are mathematically sufficient. The structured program theorem provides the theoretical foundation for this method. It states that sequencing, selection, and iteration can express any computable function. This means any task a computer can perform can be written using only these three patterns. While this idea relates to how central processing units work, the theorem is often credited to a 1966 paper by Böhm and Jacopini. This mathematical proof proved that the complex jumps of older methods were not strictly necessary.

Structured program patterns.svg
Structured program patterns.svg

The movement grew quickly during the late 1950s and 1960s. It emerged alongside the appearance of the ALGOL 58 and ALGOL 60 programming languages. ALGOL 60 was particularly important because it included support for block structures. A major turning point occurred in 1968 when Dutch computer scientist Edsger W. Dijkstra wrote an influential letter. His letter was titled "Go To Statement Considered Harmful." Dijkstra is actually the person who coined the term "structured programming." His work helped move the industry away from non-structured programming styles.

Structured program patterns.svg
Structured program patterns.svg

Many brilliant minds contributed to the development of these ideas during the 1960s and 1970s. Scientists such as Robert W. Floyd, Tony Hoare, Ole-Johan Dahl, and David Gries all made major contributions. There was also significant debate among experts. For example, Donald Knuth agreed that programs should be easy to prove as correct. However, he disagreed with completely banning the "goto" statement. In 1974, Knuth argued that direct jumps could sometimes make code more efficient and clear. He even proposed a specific rule for using jumps without creating a mess.

Structured program patterns.svg
Structured program patterns.svg

In the 1970s, the movement gained a powerful ally in IBM researcher Harlan Mills. He applied structured programming theory to build an indexing system for The New York Times research file. This project was a massive engineering success. Because of this success, many other companies began adopting these structured methods. Despite this, some people continued to argue against the strict rules. As late as 1987, Frank Rubin wrote a letter questioning the famous "Go To Statement Considered Harmful" idea. This shows that the transition to structured programming was a deep and ongoing discussion.

Structured program patterns.svg
Structured program patterns.svg

While the core rules are strict, many modern languages allow for some deviations. For instance, most languages allow for an "early return" or an "early exit." This means a program can leave a block of code before it reaches the very end. While the original theorem suggests there should be only one exit point, many developers find multiple exits more clear. Some experts, like Kent Beck and Martin Fowler, argue that clarity is more important than following strict rules. They suggest that using "guard clauses" can sometimes make code easier to understand than deeply nested structures. This balance between strict theory and practical clarity defines how we write software today.

651 words
🖼️ Images & Media (1)
File:Structured_program_patterns.svg
Structured_program_patterns.svg
Up Next
💻
Modular programming
Technology
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.