Knowledge (XXG)

Structured programming

Source đź“ť

773:.) Watt notes that an abnormal situation (generally exemplified with arithmetic overflows or input/output failures like file not found) is a kind of error that "is detected in some low-level program unit, but a handler is more naturally located in a high-level program unit". For example, a program might contain several calls to read files, but the action to perform when a file is not found depends on the meaning (purpose) of the file in question to the program and thus a handling routine for this abnormal situation cannot be located in low-level system code. Watts further notes that introducing status flags testing in the caller, as single-exit structured programming or even (multi-exit) return sequencers would entail, results in a situation where "the application code tends to get cluttered by tests of status flags" and that "the programmer might forgetfully or lazily omit to test a status flag. In fact, abnormal situations represented by status flags are by default ignored!" He notes that in contrast to status flags testing, exceptions have the opposite 584:, Watt uniformly describes the control flow constructs found in contemporary programming languages and attempts to explain why certain types of sequencers are preferable to others in the context of multi-exit control flows. Watt writes that unrestricted gotos (jump sequencers) are bad because the destination of the jump is not self-explanatory to the reader of a program until the reader finds and examines the actual label or address that is the target of the jump. In contrast, Watt argues that the conceptual intent of a return sequencer is clear from its own context, without having to examine its destination. Watt writes that a class of sequencers known as 565:. Their 2009 book flatly states that "one exit point is really not a useful rule. Clarity is the key principle: If the method is clearer with one exit point, use one exit point; otherwise don’t". They offer a cookbook solution for transforming a function consisting only of nested conditionals into a sequence of guarded return (or throw) statements, followed by a single unguarded block, which is intended to contain the code for the common case, while the guarded statements are supposed to deal with the less common ones (or with errors). 588:, defined as a "sequencer that terminates execution of a textually enclosing command or procedure", encompasses both breaks from loops (including multi-level breaks) and return statements. Watt also notes that while jump sequencers (gotos) have been somewhat restricted in languages like C, where the target must be an inside the local block or an encompassing outer block, that restriction alone is not sufficient to make the intent of gotos in C self-describing and so they can still produce " 858:(particularly input/output), state machines, and concurrency. From a code execution point of view, yielding from a coroutine is closer to structured programming than returning from a subroutine, as the subprogram has not actually terminated, and will continue when called again – it is not an early exit. However, coroutines mean that multiple subprograms have execution state – rather than a single call stack of subroutines – and thus introduce a different form of complexity. 166: 777:, causing the program to terminate unless the programmer explicitly deals with the exception in some way, possibly by adding code to willfully ignore it. Based on these arguments, Watt concludes that jump sequencers or escape sequencers (discussed in the previous section) are not as suitable as a dedicated exception sequencer with the semantics discussed above. 1016:, p. 147, "The unbridled use of the go to statement has as an immediate consequence that it becomes terribly hard to find a meaningful set of coordinates in which to describe the process progress. ... The go to statement as it stands is just too primitive, it is too much an invitation to make a mess of one's program." 417:
As late as 1987 it was still possible to raise the question of structured programming in a computer science journal. Frank Rubin did so in that year with an open letter titled "'GOTO Considered Harmful' Considered Harmful". Numerous objections followed, including a response from Dijkstra that sharply
371:
Us converts waved this interesting bit of news under the noses of the unreconstructed assembly-language programmers who kept trotting forth twisty bits of logic and saying, 'I betcha can't structure this.' Neither the proof by Böhm and Jacopini nor our repeated successes at writing structured code
784:
loops because the transfer of control "is set up at a different point in the program than that where the actual transfer takes place. At the point where the transfer actually occurs, there may be no syntactic indication that control will in fact be transferred." Computer science professor Arvind
761:
in a function constitutes a violation of the single-exit principle, but argues that Dijkstra's rules were written in a time before exception handling became a paradigm in programming languages, so he proposes to allow any number of throw points in addition to a single return point. He notes that
379:
accepted the principle that programs must be written with provability in mind, but he disagreed with abolishing the GOTO statement, and as of 2018 has continued to use it in his programs. In his 1974 paper, "Structured Programming with Goto Statements", he gave examples where he believed that a
1332:
Example 4: Single entry, single exit ("SESE"). Historically, some coding standards have required that each function have exactly one exit, meaning one return statement. Such a requirement is obsolete in languages that support exceptions and destructors, where functions typically have numerous
966: 492:
Multiple exits can arise for a variety of reasons, most often either that the subroutine has no more work to do (if returning a value, it has completed the calculation), or has encountered "exceptional" circumstances that prevent it from continuing, hence needing exception handling.
629:, software developer Jim Bonang argues that any exceptions thrown from a function violate the single-exit paradigm, and proposes that all inter-procedural exceptions should be forbidden. Bonang proposes that all single-exit conforming C++ should be written along the lines of: 327:. Therefore, a processor is always executing a "structured program" in this sense, even if the instructions it reads from memory are not part of a structured program. However, authors usually credit the result to a 1966 paper by Böhm and Jacopini, possibly because 762:
solutions that wrap exceptions for the sake of creating a single-exit have higher nesting depth and thus are more difficult to comprehend, and even accuses those who propose to apply such solutions to programming languages that support exceptions of engaging in
488:
is an early and prominent example of these constructs. Some newer languages also have "labeled breaks", which allow breaking out of more than just the innermost loop. Exceptions also allow early exit, but have further consequences, and thus are treated below.
504:. These must be done at each return site, which is brittle and can easily result in bugs. For instance, in later development, a return statement could be overlooked by a developer, and an action that should be performed at the end of a subroutine (e.g., a 1208:, dated 10 June 2001, Dijkstra writes, "Apparently, IBM did not like the popularity of my text; it stole the term "Structured Programming" and under its auspices Harlan D. Mills trivialized the original concept to the abolishment of the goto statement." 413:
research file. The project was a great engineering success, and managers at other companies cited it in support of adopting structured programming, although Dijkstra criticized the ways that Mills's interpretation differed from the published work.
76:
programming languages, with the latter including support for block structures. Contributing factors to its popularity and widespread acceptance, at first in academia and later among practitioners, include the discovery of what is now known as the
426:
By the end of the 20th century, nearly all computer scientists were convinced that it is useful to learn and apply the concepts of structured programming. High-level programming languages that originally lacked programming structures, such as
452:
for early exit from a subroutine. This results in multiple exit points, instead of the single exit point required by structured programming. There are other constructions to handle cases that are awkward in purely structured programming.
483:
statement (terminate the current iteration, proceed with next iteration). In structured programming, these can be replicated by adding additional branches or tests, but for returns from nested code this can add significant complexity.
447:
While goto has now largely been replaced by the structured constructs of selection (if/then/else) and repetition (while and for), few languages are purely structured. The most common deviation, found in many languages, is the use of a
882:
that follow each other in a way that is not easily reduced to the basic structures, and some programmers implement the state-changes with a jump to the new state. This type of state-switching is often used in the Linux kernel.
331:
cited this paper himself. The structured program theorem does not address how to write and analyze a usefully structured program. These issues were addressed during the late 1960s and early 1970s, with major contributions by
1721:
Note that the third chapter of this book, by Dahl, describes an approach that is easily recognized as Object Oriented Programming. It can be seen as another way to "usefully structure" a program to aid in showing that it is
1390: 789:, which have the single-exit property in absence of exceptions, no longer have it in presence of exceptions, because an exception can prematurely cause an early exit in any part of the control structure; for instance if 861:
It is very rare for subprograms to allow entry to an arbitrary position in the subprogram, as in this case the program state (such as variable values) is uninitialized or ambiguous, and this is very similar to a goto.
1894: 137:"Iteration"; a statement or block is executed until the program reaches a certain state, or operations have been applied to every element of a collection. This is usually expressed with keywords such as 523:. Most commonly this is done via unwind protection, which ensures that certain code is guaranteed to be run when execution exits a block; this is a structured alternative to having a cleanup block and a 1716: 311:
provides the theoretical basis of structured programming. It states that three ways of combining programs—sequencing, selection, and iteration—are sufficient to express any
1800: 496:
The most common problem in early exit is that cleanup or final statements are not executed – for example, allocated memory is not deallocated, or open files are not closed, causing
1382: 161:. Often it is recommended that each loop should only have one entry point (and in the original structural programming, also only one exit point, and a few languages enforce this). 1864: 280:
but most new procedural programming languages since that time have included features to encourage structured programming, and sometimes deliberately left out features – notably
380:
direct jump leads to clearer and more efficient code without sacrificing provability. Knuth proposed a looser structural constraint: It should be possible to draw a program's
1813: 988: 1963: 294:(sometimes known as modular programming) enforces a logical structure on the program being written to make it more efficient and easier to understand and modify. 1898: 886:
However, it is possible to structure these systems by making each state-change a separate subprogram and using a variable to indicate the active state (see
1793: 797:, then the usual exit point after check() is not reached. Citing multiple prior studies by others (1999–2004) and their own results, Westley Weimer and 543:
without exceptions might look strange. Various techniques exist to encapsulate resource management. An alternative approach, found primarily in C++, is
801:
wrote that a significant problem with exceptions is that they "create hidden control-flow paths that are difficult for programmers to reason about".
2027: 2377: 2239: 1670: 2383: 1154: 544: 384:
with all forward branches on the left, all backward branches on the right, and no branches crossing each other. Many of those knowledgeable in
592:". Watt also examines how exception sequencers differ from escape and jump sequencers; this is explained in the next section of this article. 193:; callable units such as procedures, functions, methods, or subprograms are used to allow a sequence to be referred to by a single statement. 1786: 1737: 1531: 1457: 1432: 1366: 1325: 1300: 1109: 547:, which uses normal stack unwinding (variable deallocation) at function exit to call destructors on local variables to deallocate resources. 850:/semicoroutine), where a subprogram yields control (and possibly a value), but can then be resumed where it left off. There are a number of 2568: 2316: 1277: 1029: 1474: 1219: 561:
books that nested conditionals may be harder to understand than a certain type of flatter structure using multiple exits predicated by
2036: 92:
Structured programming is most frequently used with deviations that allow for clearer programs in some particular cases, such as when
82: 46: 950: 816:, do not allow early exits from inside to the outside of the parallel construct; this restriction includes all manner of exits, from 1699: 1053: 960: 554: 2408: 2088: 2032: 847: 620: 2268: 2141: 2072: 2007: 1930: 577: 520: 315:. This observation did not originate with the structured programming movement; these structures are sufficient to describe the 257: 2629: 2446: 2209: 1839: 1611: 125: 124:"Selection"; one of a number of statements is executed depending on the state of the program. This is usually expressed with 909: 174: 2224: 2214: 1992: 780:
The textbook by Louden and Lambert emphasizes that exception handling differs from structured programming constructs like
509: 265: 233: 225: 1709:, above, including an extended example of using the structured approach to develop a backtracking algorithm to solve the 256:
It is possible to do structured programming in any programming language, though it is preferable to use something like a
134:. The conditional statement should have at least one true condition and each condition should have one exit point at max. 2608: 2588: 2518: 2461: 2423: 2413: 2373: 2298: 2234: 2204: 2131: 2120: 2017: 1997: 1972: 1935: 2563: 2326: 2293: 2188: 2164: 2126: 2106: 2002: 1911: 1889: 1874: 820:
to C++ exceptions, but all of these are permitted inside the parallel construct if the jump target is also inside it.
2510: 2496: 2403: 2363: 2288: 2194: 2174: 2041: 1920: 1854: 804:
The necessity to limit code to single-exit points appears in some contemporary programming environments focused on
774: 308: 277: 273: 170: 110: 78: 2603: 2368: 2278: 2258: 2244: 1634: 1576: 129: 2583: 2543: 2486: 2418: 2156: 1987: 879: 485: 285: 241: 580:
writes that "single-entry multi-exit control flows are often desirable". Using Tennent's framework notion of
2593: 2573: 2514: 2501: 2481: 2308: 2045: 1949: 1907: 875: 320: 785:
Kumar Bansal also notes that in languages which implement exception handling, even control structures like
2553: 2528: 2522: 2466: 2428: 2116: 2111: 2063: 1958: 1859: 1822: 1766: 1585: 1203: 919: 887: 769:
David Watt also analyzes exception handling in the framework of sequencers (introduced in this article in
763: 208:
languages have a syntax for enclosing structures in some formal way, such as an if-statement bracketed by
407:
applied his interpretation of structured programming theory to the development of an indexing system for
2455: 2451: 2393: 2345: 1915: 393: 519:
Most modern languages provide language-level support to prevent such leaks; see detailed discussion at
508:
statement) might not be performed in all cases. Languages without a return statement, such as standard
2598: 2578: 2538: 2340: 2199: 2068: 2055: 1809: 626: 229: 34: 1590: 1185: 2533: 2471: 2283: 2263: 2249: 1981: 1849: 1844: 1771: 1710: 570: 312: 201: 58: 2350: 2303: 2273: 2219: 2078: 1977: 1869: 1778: 1659: 1603: 1497: 1242: 1177: 982: 904: 855: 805: 532: 505: 409: 333: 328: 245: 93: 86: 1101: 890:). Alternatively, these can be implemented via coroutines, which dispense with the trampoline. 2506: 2398: 2253: 2229: 2169: 2136: 2098: 2083: 2022: 1733: 1695: 1651: 1527: 1453: 1428: 1362: 1321: 1296: 1105: 1054:"Reading: Structured Programming | ITE 115 Introduction to Computer Applications and Concepts" 956: 573:
also argue in their 2004 C++ tips book that the single-exit point is an obsolete requirement.
316: 165: 114: 1505: 1250: 2388: 2320: 2184: 1925: 1643: 1595: 1489: 1234: 1169: 924: 449: 38: 2634: 2438: 2312: 2178: 1879: 1622: 1551: 1268: 914: 337: 1763:
In Programming Models for Massively Parallel Computers. IEEE Computer Society Press. 1993
1626: 1564: 1125: 1555: 1383:"Single-Entry, Single-Exit, Should It Still be Applicable in Object-oriented Languages?" 2490: 2146: 2012: 1688: 1684: 1680: 1094: 596: 589: 345: 324: 2623: 2476: 1181: 1089: 798: 501: 418:
criticized both Rubin and the concessions other writers made when responding to him.
367:
of structured programming, described his reaction to the structured program theorem:
364: 360: 204:
are used to enable groups of statements to be treated as if they were one statement.
156: 144: 1663: 1607: 1501: 1246: 562: 462: 404: 389: 376: 42: 1568: 2358: 566: 558: 497: 349: 62: 372:
brought them around one day sooner than they were ready to convince themselves.
381: 341: 190: 178: 138: 50: 1761:
J. Darlinton; M. Ghanem; H. W. To (1993), "Structured Parallel Programming",
1655: 1569:"Flow Diagrams, Turing Machines and Languages with Only Two Formation Rules" 1493: 851: 843: 829: 550: 260:. Some of the languages initially used for structured programming include: 1647: 1599: 1238: 1173: 17: 385: 213: 150: 73: 69: 54: 399:
Structured programming theorists gained a major ally in the 1970s after
871: 581: 428: 1754: 899: 809: 1757:- A tool to structure concurrent systems (programs, process models) 1359:
Touch of Class: Learning to Program Well with Objects and Contracts
121:"Sequence"; ordered statements or subroutines executed in sequence. 37:
aimed at improving the clarity, quality, and development time of a
513: 436: 432: 261: 164: 281: 269: 221: 1782: 1318:
C++ Coding Standards: 101 Rules, Guidelines, and Best Practices
471:
from a function or loop. At the level of functions, this is a
400: 955:(3rd ed.). Harlow, England: Addison-Wesley. p. 20. 611:
in sheep's clothing" and strongly advised against their use.
1627:"Letters to the editor: Go to statement considered harmful" 1291:
Jay Fields; Shane Harvie; Martin Fowler; Kent Beck (2009).
753:
Peter Ritchie also notes that, in principle, even a single
949:
Clark, Leslie B. Wilson, Robert G.; Robert, Clark (2000).
1267:
Elder, Matt; Jackson, Steve; Liblit, Ben (October 2008).
467:
The most common deviation from structured programming is
68:
It emerged in the late 1950s with the appearance of the
1361:. Springer Science & Business Media. p. 189. 1482:
ACM Transactions on Programming Languages and Systems
1134:. University of Waterloo. 15 Nov 2018. 48 minutes in 812:. The various parallel constructs from OpenMP, like 2552: 2437: 2339: 2155: 2097: 2054: 1957: 1948: 1888: 1830: 1821: 1093: 599:wrote in his 2009 textbook that instructions like 85:" open letter in 1968 by Dutch computer scientist 1096:Programming on Purpose, Essays on Software Design 81:in 1966, and the publication of the influential " 1717:a pdf version is in the ACM Classic Books Series 1705:this volume includes an expanded version of the 1475:"Exceptional Situations and Program Reliability" 89:, who coined the term "structured programming". 1427:(3rd ed.). Cengage Learning. p. 423. 1425:Programming Languages: Principles and Practices 1204:"What led to "Notes on Structured Programming"" 369: 1728:Watt, David Anthony; Findlay, William (2004). 1423:Kenneth C. Louden; Kenneth A. Lambert (2011). 1220:""GOTO Considered Harmful" Considered Harmful" 1155:"Structured programming with go to statements" 173:— sequence, selection, and repetition — using 1794: 113:, all programs are seen as composed of three 8: 1001: 987:: CS1 maint: multiple names: authors list ( 475:statement. At the level of loops, this is a 1410: 1344: 1127:DLS • Donald Knuth • All Questions Answered 1954: 1827: 1801: 1787: 1779: 673:// Do something that may throw exceptions. 41:by making extensive use of the structured 27:Programming paradigm based on control flow 1865:Programming in the large and in the small 1770: 1589: 1316:Herb Sutter; Andrei Alexandrescu (2004). 1076: 1013: 834:More rarely, subprograms allow multiple 1295:. Pearson Education. pp. 274–279. 1100:(1st ed.). Prentice-Hall. p.  941: 1473:Weimer, W. & Necula, G.C. (2008). 980: 545:Resource Acquisition Is Initialization 1450:Introduction to Programming Languages 969:from the original on 26 November 2015 7: 1730:Programming language design concepts 1024: 1022: 733:// All exceptions caught and logged. 557:and co-authors have argued in their 771:the previous section on early exits 706:// Other code similar to the above. 625:Based on the coding error from the 479:statement (terminate the loop) or 83:Go To Statement Considered Harmful 25: 1567:; Jacopini, Giuseppe (May 1966). 1153:Donald E. Knuth (December 1974). 1030:"What is Structured Programming?" 952:Comparative programming languages 854:of such programming, notably for 216:, or a code section bracketed by 2409:Partitioned global address space 1694:, Academic Press, London, 1972. 1617:from the original on 2015-09-23. 621:Exception handling (programming) 323:, as well as the operation of a 252:Structured programming languages 169:Graphical representation of the 1707:Notes on Structured Programming 1677:, Academic Press, London, 1975. 1557:Notes on Structured Programming 1526:. Morgan Kaufmann. p. 45. 1393:from the original on 2012-11-14 1278:University of Wisconsin–Madison 795:for (init(); check(); increm()) 770: 258:procedural programming language 1524:Parallel Programming in OpenMP 527:. This is most often known as 1: 392:have advocated allowing only 1936:Uniform Function Call Syntax 1675:Principles of Program Design 1448:Arvind Kumar Bansal (2013). 870:Some programs, particularly 516:, do not have this problem. 2404:Parallel programming models 2378:Concurrent constraint logic 838:This is most commonly only 2651: 2497:Metalinguistic abstraction 2364:Automatic mutual exclusion 1452:. CRC Press. p. 135. 1218:Frank Rubin (March 1987). 827: 618: 595:In contrast to the above, 460: 309:structured program theorem 111:structured program theorem 79:structured program theorem 2369:Choreographic programming 1732:. John Wiley & Sons. 1635:Communications of the ACM 1577:Communications of the ACM 1293:Refactoring: Ruby Edition 1227:Communications of the ACM 1058:courses.lumenlearning.com 910:Nassi–Shneiderman diagram 531:and considered a part of 45:constructs of selection ( 2419:Relativistic programming 1387:Peter Ritchie's MVP Blog 1002:Böhm & Jacopini 1966 876:communications protocols 631: 286:unstructured programming 1494:10.1145/1330017.1330019 1411:Watt & Findlay 2004 1357:Bertrand Meyer (2009). 1345:Watt & Findlay 2004 793:throws an exception in 539:statements introducing 321:central processing unit 284:– in an effort to make 2429:Structured concurrency 1814:Comparison by language 1692:Structured Programming 1522:Rohit Chandra (2001). 920:Structured concurrency 576:In his 2004 textbook, 535:. In case of multiple 374: 303:Theoretical foundation 292:Structured programming 236:, or the curly braces 182: 31:Structured programming 2630:Programming paradigms 2394:Multitier programming 2210:Interface description 1810:Programming paradigms 1648:10.1145/362929.362947 1600:10.1145/355592.365646 1320:. Pearson Education. 1239:10.1145/214748.315722 1174:10.1145/356635.356640 1092:(February 12, 1993). 828:Further information: 697:SomeInternalException 619:Further information: 461:Further information: 394:reducible flow graphs 168: 131:if..then..else..endif 96:has to be performed. 1276:(Technical report). 246:many later languages 171:three basic patterns 35:programming paradigm 2534:Self-modifying code 2142:Probabilistic logic 2073:Functional reactive 2028:Expression-oriented 1982:Partial application 1623:Dijkstra, Edsger W. 1413:, pp. 221–222. 1347:, pp. 215–221. 878:, have a number of 627:Ariane 501 disaster 571:Andrei Alexandrescu 521:resource management 313:computable function 2447:Attribute-oriented 2220:List comprehension 2165:Algebraic modeling 1978:Anonymous function 1870:Design by contract 1840:Jackson structures 1671:Michael A. Jackson 905:Minimal evaluation 806:parallel computing 615:Exception handling 607:"are just the old 533:exception handling 410:The New York Times 232:indentation as in 183: 115:control structures 105:Control structures 94:exception handling 87:Edsger W. Dijkstra 49:) and repetition ( 2617: 2616: 2507:Program synthesis 2399:Organic computing 2335: 2334: 2240:Non-English-based 2215:Language-oriented 1993:Purely functional 1944: 1943: 1739:978-0-470-85320-7 1533:978-1-55860-671-5 1459:978-1-4665-6514-2 1434:978-1-111-52941-3 1368:978-3-540-92144-8 1327:978-0-13-265442-5 1302:978-0-321-60350-0 1162:Computing Surveys 1111:978-0-13-721374-0 757:right before the 586:escape sequencers 443:Common deviations 439:, now have them. 317:instruction cycle 16:(Redirected from 2642: 2519:by demonstration 2424:Service-oriented 2414:Process-oriented 2389:Macroprogramming 2374:Concurrent logic 2245:Page description 2235:Natural language 2205:Grammar-oriented 2132:Nondeterministic 2121:Constraint logic 2023:Point-free style 2018:Functional logic 1955: 1926:Immutable object 1845:Block-structured 1828: 1803: 1796: 1789: 1780: 1775: 1774: 1743: 1711:8 Queens problem 1667: 1631: 1618: 1616: 1593: 1573: 1538: 1537: 1519: 1513: 1512: 1510: 1504:. Archived from 1479: 1470: 1464: 1463: 1445: 1439: 1438: 1420: 1414: 1408: 1402: 1401: 1399: 1398: 1389:. 7 March 2008. 1379: 1373: 1372: 1354: 1348: 1342: 1336: 1335: 1313: 1307: 1306: 1288: 1282: 1281: 1275: 1264: 1258: 1257: 1255: 1249:. Archived from 1224: 1215: 1209: 1207: 1199: 1193: 1192: 1190: 1184:. Archived from 1159: 1150: 1144: 1143: 1141: 1139: 1122: 1116: 1115: 1099: 1086: 1080: 1074: 1068: 1067: 1065: 1064: 1050: 1044: 1043: 1041: 1040: 1034:Software Quality 1026: 1017: 1011: 1005: 999: 993: 992: 986: 978: 976: 974: 946: 925:Switch statement 819: 815: 796: 792: 788: 783: 775:default behavior 760: 756: 749: 746: 743: 740: 737: 734: 731: 728: 725: 722: 719: 716: 713: 710: 707: 704: 701: 698: 695: 692: 689: 686: 683: 680: 677: 674: 671: 668: 665: 662: 659: 656: 653: 650: 647: 644: 641: 638: 635: 610: 606: 602: 542: 538: 530: 526: 482: 478: 474: 450:return statement 288:more difficult. 239: 219: 211: 206:Block-structured 159: 153: 147: 141: 132: 59:block structures 39:computer program 21: 2650: 2649: 2645: 2644: 2643: 2641: 2640: 2639: 2620: 2619: 2618: 2613: 2555: 2548: 2439:Metaprogramming 2433: 2349: 2344: 2331: 2313:Graph rewriting 2151: 2127:Inductive logic 2107:Abductive logic 2093: 2050: 2013:Dependent types 1961: 1940: 1912:Prototype-based 1892: 1890:Object-oriented 1884: 1880:Nested function 1875:Invariant-based 1817: 1807: 1760: 1751: 1746: 1740: 1727: 1629: 1621: 1614: 1591:10.1.1.119.9119 1571: 1563: 1552:Edsger Dijkstra 1547: 1542: 1541: 1534: 1521: 1520: 1516: 1508: 1477: 1472: 1471: 1467: 1460: 1447: 1446: 1442: 1435: 1422: 1421: 1417: 1409: 1405: 1396: 1394: 1381: 1380: 1376: 1369: 1356: 1355: 1351: 1343: 1339: 1333:implicit exits. 1328: 1315: 1314: 1310: 1303: 1290: 1289: 1285: 1273: 1270:Code Sandwiches 1266: 1265: 1261: 1253: 1222: 1217: 1216: 1212: 1202: 1200: 1196: 1188: 1157: 1152: 1151: 1147: 1137: 1135: 1124: 1123: 1119: 1112: 1088: 1087: 1083: 1075: 1071: 1062: 1060: 1052: 1051: 1047: 1038: 1036: 1028: 1027: 1020: 1012: 1008: 1000: 996: 979: 972: 970: 963: 948: 947: 943: 938: 933: 915:Structure chart 896: 868: 832: 826: 817: 813: 794: 790: 786: 781: 758: 754: 751: 750: 747: 744: 741: 738: 735: 732: 729: 726: 723: 720: 717: 714: 711: 708: 705: 702: 699: 696: 693: 690: 687: 684: 681: 678: 675: 672: 669: 666: 663: 660: 657: 654: 651: 648: 645: 642: 639: 636: 633: 623: 617: 608: 604: 600: 540: 536: 528: 524: 480: 476: 472: 465: 459: 445: 424: 358: 338:Robert W. Floyd 305: 300: 254: 237: 217: 209: 199: 188: 157: 151: 145: 139: 130: 107: 102: 28: 23: 22: 15: 12: 11: 5: 2648: 2646: 2638: 2637: 2632: 2622: 2621: 2615: 2614: 2612: 2611: 2606: 2601: 2596: 2591: 2586: 2581: 2576: 2571: 2566: 2560: 2558: 2550: 2549: 2547: 2546: 2541: 2536: 2531: 2526: 2504: 2499: 2494: 2484: 2479: 2474: 2469: 2464: 2459: 2449: 2443: 2441: 2435: 2434: 2432: 2431: 2426: 2421: 2416: 2411: 2406: 2401: 2396: 2391: 2386: 2381: 2371: 2366: 2361: 2355: 2353: 2337: 2336: 2333: 2332: 2330: 2329: 2324: 2309:Transformation 2306: 2301: 2296: 2291: 2286: 2281: 2276: 2271: 2266: 2261: 2256: 2247: 2242: 2237: 2232: 2227: 2222: 2217: 2212: 2207: 2202: 2197: 2195:Differentiable 2192: 2182: 2175:Automata-based 2172: 2167: 2161: 2159: 2153: 2152: 2150: 2149: 2144: 2139: 2134: 2129: 2124: 2114: 2109: 2103: 2101: 2095: 2094: 2092: 2091: 2086: 2081: 2076: 2066: 2060: 2058: 2052: 2051: 2049: 2048: 2042:Function-level 2039: 2030: 2025: 2020: 2015: 2010: 2005: 2000: 1995: 1990: 1985: 1975: 1969: 1967: 1952: 1946: 1945: 1942: 1941: 1939: 1938: 1933: 1928: 1923: 1918: 1904: 1902: 1886: 1885: 1883: 1882: 1877: 1872: 1867: 1862: 1857: 1855:Non-structured 1852: 1847: 1842: 1836: 1834: 1825: 1819: 1818: 1808: 1806: 1805: 1798: 1791: 1783: 1777: 1776: 1772:10.1.1.37.4610 1758: 1750: 1749:External links 1747: 1745: 1744: 1738: 1725: 1724: 1723: 1719: 1714: 1689:C. A. R. Hoare 1685:E. W. Dijkstra 1678: 1668: 1642:(3): 147–148. 1625:(March 1968). 1619: 1584:(5): 366–371. 1561: 1548: 1546: 1543: 1540: 1539: 1532: 1514: 1511:on 2015-09-23. 1465: 1458: 1440: 1433: 1415: 1403: 1374: 1367: 1349: 1337: 1326: 1308: 1301: 1283: 1259: 1256:on 2009-03-20. 1233:(3): 195–196. 1210: 1194: 1191:on 2013-10-23. 1168:(4): 261–301. 1145: 1117: 1110: 1090:Plauger, P. J. 1081: 1069: 1045: 1018: 1006: 994: 961: 940: 939: 937: 934: 932: 929: 928: 927: 922: 917: 912: 907: 902: 895: 892: 867: 866:State machines 864: 842:-entry into a 825: 824:Multiple entry 822: 632: 616: 613: 597:Bertrand Meyer 590:spaghetti code 541:try...finally, 529:try...finally, 502:resource leaks 458: 455: 444: 441: 423: 420: 357: 354: 346:Ole-Johan Dahl 325:Turing machine 304: 301: 299: 296: 253: 250: 198: 195: 187: 184: 163: 162: 135: 122: 109:Following the 106: 103: 101: 98: 26: 24: 14: 13: 10: 9: 6: 4: 3: 2: 2647: 2636: 2633: 2631: 2628: 2627: 2625: 2610: 2607: 2605: 2602: 2600: 2597: 2595: 2592: 2590: 2587: 2585: 2582: 2580: 2579:Data-oriented 2577: 2575: 2572: 2570: 2567: 2565: 2562: 2561: 2559: 2557: 2551: 2545: 2542: 2540: 2537: 2535: 2532: 2530: 2527: 2524: 2520: 2516: 2512: 2508: 2505: 2503: 2500: 2498: 2495: 2492: 2488: 2485: 2483: 2480: 2478: 2477:Homoiconicity 2475: 2473: 2470: 2468: 2465: 2463: 2460: 2457: 2453: 2450: 2448: 2445: 2444: 2442: 2440: 2436: 2430: 2427: 2425: 2422: 2420: 2417: 2415: 2412: 2410: 2407: 2405: 2402: 2400: 2397: 2395: 2392: 2390: 2387: 2385: 2384:Concurrent OO 2382: 2379: 2375: 2372: 2370: 2367: 2365: 2362: 2360: 2357: 2356: 2354: 2352: 2347: 2342: 2338: 2328: 2325: 2322: 2318: 2314: 2310: 2307: 2305: 2302: 2300: 2297: 2295: 2292: 2290: 2287: 2285: 2282: 2280: 2279:Set-theoretic 2277: 2275: 2272: 2270: 2267: 2265: 2262: 2260: 2259:Probabilistic 2257: 2255: 2251: 2248: 2246: 2243: 2241: 2238: 2236: 2233: 2231: 2228: 2226: 2223: 2221: 2218: 2216: 2213: 2211: 2208: 2206: 2203: 2201: 2198: 2196: 2193: 2190: 2186: 2183: 2180: 2176: 2173: 2171: 2168: 2166: 2163: 2162: 2160: 2158: 2154: 2148: 2145: 2143: 2140: 2138: 2135: 2133: 2130: 2128: 2125: 2122: 2118: 2115: 2113: 2110: 2108: 2105: 2104: 2102: 2100: 2096: 2090: 2087: 2085: 2082: 2080: 2077: 2074: 2070: 2067: 2065: 2062: 2061: 2059: 2057: 2053: 2047: 2043: 2040: 2038: 2037:Concatenative 2034: 2031: 2029: 2026: 2024: 2021: 2019: 2016: 2014: 2011: 2009: 2006: 2004: 2001: 1999: 1996: 1994: 1991: 1989: 1986: 1983: 1979: 1976: 1974: 1971: 1970: 1968: 1965: 1960: 1956: 1953: 1951: 1947: 1937: 1934: 1932: 1929: 1927: 1924: 1922: 1919: 1917: 1913: 1909: 1906: 1905: 1903: 1900: 1896: 1891: 1887: 1881: 1878: 1876: 1873: 1871: 1868: 1866: 1863: 1861: 1858: 1856: 1853: 1851: 1848: 1846: 1843: 1841: 1838: 1837: 1835: 1833: 1829: 1826: 1824: 1820: 1815: 1811: 1804: 1799: 1797: 1792: 1790: 1785: 1784: 1781: 1773: 1768: 1764: 1759: 1756: 1753: 1752: 1748: 1741: 1735: 1731: 1726: 1720: 1718: 1715: 1712: 1708: 1704: 1703: 1701: 1700:0-12-200550-3 1697: 1693: 1690: 1686: 1682: 1679: 1676: 1672: 1669: 1665: 1661: 1657: 1653: 1649: 1645: 1641: 1637: 1636: 1628: 1624: 1620: 1613: 1609: 1605: 1601: 1597: 1592: 1587: 1583: 1579: 1578: 1570: 1566: 1565:Böhm, Corrado 1562: 1559: 1558: 1553: 1550: 1549: 1544: 1535: 1529: 1525: 1518: 1515: 1507: 1503: 1499: 1495: 1491: 1487: 1483: 1476: 1469: 1466: 1461: 1455: 1451: 1444: 1441: 1436: 1430: 1426: 1419: 1416: 1412: 1407: 1404: 1392: 1388: 1384: 1378: 1375: 1370: 1364: 1360: 1353: 1350: 1346: 1341: 1338: 1334: 1329: 1323: 1319: 1312: 1309: 1304: 1298: 1294: 1287: 1284: 1279: 1272: 1271: 1263: 1260: 1252: 1248: 1244: 1240: 1236: 1232: 1228: 1221: 1214: 1211: 1205: 1198: 1195: 1187: 1183: 1179: 1175: 1171: 1167: 1163: 1156: 1149: 1146: 1133: 1129: 1128: 1121: 1118: 1113: 1107: 1103: 1098: 1097: 1091: 1085: 1082: 1078: 1077:Dijkstra 1968 1073: 1070: 1059: 1055: 1049: 1046: 1035: 1031: 1025: 1023: 1019: 1015: 1014:Dijkstra 1968 1010: 1007: 1003: 998: 995: 990: 984: 968: 964: 962:9780201710120 958: 954: 953: 945: 942: 935: 930: 926: 923: 921: 918: 916: 913: 911: 908: 906: 903: 901: 898: 897: 893: 891: 889: 884: 881: 877: 873: 865: 863: 859: 857: 853: 849: 845: 841: 837: 831: 823: 821: 811: 807: 802: 800: 799:George Necula 778: 776: 772: 767: 765: 630: 628: 622: 614: 612: 598: 593: 591: 587: 583: 579: 574: 572: 568: 564: 563:guard clauses 560: 556: 555:Martin Fowler 552: 548: 546: 534: 522: 517: 515: 511: 507: 503: 499: 494: 490: 487: 470: 464: 456: 454: 451: 442: 440: 438: 434: 430: 421: 419: 415: 412: 411: 406: 402: 397: 395: 391: 387: 383: 378: 373: 368: 366: 365:early adopter 362: 361:P. J. Plauger 355: 353: 351: 347: 343: 339: 335: 330: 326: 322: 318: 314: 310: 302: 297: 295: 293: 289: 287: 283: 279: 275: 271: 267: 263: 259: 251: 249: 247: 243: 235: 231: 227: 223: 215: 207: 203: 196: 194: 192: 185: 180: 176: 172: 167: 160: 154: 148: 142: 136: 133: 127: 123: 120: 119: 118: 116: 112: 104: 99: 97: 95: 90: 88: 84: 80: 75: 71: 66: 64: 60: 56: 52: 48: 44: 40: 36: 32: 19: 2584:Event-driven 1988:Higher-order 1916:Object-based 1831: 1762: 1729: 1706: 1691: 1674: 1639: 1633: 1581: 1575: 1560:, p. 6. 1556: 1523: 1517: 1506:the original 1485: 1481: 1468: 1449: 1443: 1424: 1418: 1406: 1395:. Retrieved 1386: 1377: 1358: 1352: 1340: 1331: 1317: 1311: 1292: 1286: 1269: 1262: 1251:the original 1230: 1226: 1213: 1201:In EWD1308, 1197: 1186:the original 1165: 1161: 1148: 1136:. Retrieved 1131: 1126: 1120: 1095: 1084: 1072: 1061:. Retrieved 1057: 1048: 1037:. Retrieved 1033: 1009: 997: 971:. Retrieved 951: 944: 885: 869: 860: 839: 835: 833: 803: 779: 768: 752: 624: 594: 585: 575: 549: 518: 498:memory leaks 495: 491: 468: 466: 463:Return early 446: 425: 416: 408: 405:Harlan Mills 398: 390:graph theory 377:Donald Knuth 375: 370: 359: 306: 291: 290: 255: 205: 200: 189: 108: 91: 67: 47:if/then/else 43:control flow 30: 29: 2594:Intentional 2574:Data-driven 2556:of concerns 2515:Inferential 2502:Multi-stage 2482:Interactive 2359:Actor-based 2346:distributed 2289:Stack-based 2089:Synchronous 2046:Value-level 2033:Applicative 1950:Declarative 1908:Class-based 1765:: 160–169, 1488:(2). 8:27. 973:25 November 852:common uses 814:parallel do 567:Herb Sutter 559:refactoring 403:researcher 350:David Gries 191:Subroutines 186:Subroutines 179:flow charts 177:(blue) and 175:NS diagrams 63:subroutines 2624:Categories 2569:Components 2554:Separation 2529:Reflective 2523:by example 2467:Extensible 2341:Concurrent 2317:Production 2304:Templating 2284:Simulation 2269:Scientific 2189:Spacecraft 2117:Constraint 2112:Answer set 2064:Flow-based 1964:comparison 1959:Functional 1931:Persistent 1895:comparison 1860:Procedural 1832:Structured 1823:Imperative 1681:O.-J. Dahl 1397:2014-07-15 1063:2024-04-09 1039:2024-04-09 931:References 888:trampoline 808:, such as 766:thinking. 764:cargo cult 578:David Watt 469:early exit 457:Early exit 382:flow chart 342:Tony Hoare 230:whitespace 218:BEGIN..END 18:Early exit 2456:Inductive 2452:Automatic 2274:Scripting 1973:Recursive 1767:CiteSeerX 1656:0001-0782 1586:CiteSeerX 1182:207630080 983:cite book 936:Citations 848:generator 844:coroutine 830:Coroutine 582:sequencer 551:Kent Beck 386:compilers 158:do..until 2609:Subjects 2599:Literate 2589:Features 2544:Template 2539:Symbolic 2511:Bayesian 2491:Hygienic 2351:parallel 2230:Modeling 2225:Low-code 2200:End-user 2137:Ontology 2069:Reactive 2056:Dataflow 1755:BPStruct 1722:correct. 1664:17469809 1612:Archived 1608:10236439 1391:Archived 967:Archived 894:See also 685:MyCheck2 637:MyCheck1 605:continue 481:continue 334:Dijkstra 329:Dijkstra 220:, as in 214:ALGOL 68 181:(green). 128:such as 126:keywords 100:Elements 74:ALGOL 60 70:ALGOL 58 2564:Aspects 2472:Generic 2462:Dynamic 2321:Pattern 2299:Tactile 2264:Quantum 2254:filters 2185:Command 2084:Streams 2079:Signals 1850:Modular 1545:Sources 1502:3136431 1280:. 1647. 1247:6853038 1138:24 July 1132:YouTube 872:parsers 856:streams 742:success 709:success 655:success 429:FORTRAN 422:Outcome 298:History 2635:Holism 2327:Visual 2294:System 2179:Action 2003:Strict 1769:  1736:  1698:  1662:  1654:  1606:  1588:  1530:  1500:  1456:  1431:  1365:  1324:  1299:  1245:  1180:  1108:  959:  900:DRAKON 880:states 836:entry. 810:OpenMP 791:init() 759:return 739:return 537:return 510:Pascal 473:return 435:, and 356:Debate 348:, and 266:Pascal 234:Python 226:Pascal 212:as in 210:if..fi 202:Blocks 197:Blocks 146:repeat 61:, and 2604:Roles 2487:Macro 2250:Pipes 2170:Array 2147:Query 2099:Logic 2008:GADTs 1998:Total 1921:Agent 1660:S2CID 1630:(PDF) 1615:(PDF) 1604:S2CID 1572:(PDF) 1509:(PDF) 1498:S2CID 1478:(PDF) 1274:(PDF) 1254:(PDF) 1243:S2CID 1223:(PDF) 1189:(PDF) 1178:S2CID 1158:(PDF) 818:break 782:while 755:throw 727:(...) 724:catch 694:throw 661:false 643:throw 601:break 514:Seed7 506:trace 477:break 437:BASIC 433:COBOL 363:, an 319:of a 262:ALGOL 238:{...} 140:while 51:while 33:is a 2252:and 1899:list 1734:ISBN 1696:ISBN 1652:ISSN 1528:ISBN 1454:ISBN 1429:ISBN 1363:ISBN 1322:ISBN 1297:ISBN 1140:2022 1106:ISBN 989:link 975:2015 957:ISBN 874:and 846:(or 715:true 652:bool 634:bool 609:goto 603:and 569:and 525:goto 512:and 388:and 307:The 282:GOTO 276:and 270:PL/I 244:and 224:and 222:PL/I 72:and 53:and 2157:DSL 1644:doi 1596:doi 1490:doi 1235:doi 1170:doi 787:for 700:(); 688:()) 667:try 500:or 401:IBM 278:RPL 274:Ada 240:of 155:or 152:for 57:), 55:for 2626:: 2521:, 2517:, 2513:, 2319:, 2315:, 2044:, 2035:, 1914:, 1910:, 1897:, 1702:. 1687:, 1683:, 1673:, 1658:. 1650:. 1640:11 1638:. 1632:. 1610:. 1602:. 1594:. 1580:. 1574:. 1554:, 1496:. 1486:30 1484:. 1480:. 1385:. 1330:. 1241:. 1231:30 1229:. 1225:. 1176:. 1164:. 1160:. 1130:. 1104:. 1102:25 1056:. 1032:. 1021:^ 985:}} 981:{{ 965:. 840:re 676:if 646:() 640:() 553:, 431:, 396:. 352:. 344:, 340:, 336:, 272:, 268:, 264:, 248:. 228:, 149:, 143:, 117:: 65:. 2525:) 2509:( 2493:) 2489:( 2458:) 2454:( 2380:) 2376:( 2348:, 2343:, 2323:) 2311:( 2191:) 2187:( 2181:) 2177:( 2123:) 2119:( 2075:) 2071:( 1984:) 1980:( 1966:) 1962:( 1901:) 1893:( 1816:) 1812:( 1802:e 1795:t 1788:v 1742:. 1713:. 1666:. 1646:: 1598:: 1582:9 1536:. 1492:: 1462:. 1437:. 1400:. 1371:. 1305:. 1237:: 1206:. 1172:: 1166:6 1142:. 1114:. 1079:. 1066:. 1042:. 1004:. 991:) 977:. 748:} 745:; 736:} 730:{ 721:} 718:; 712:= 703:} 691:{ 682:! 679:( 670:{ 664:; 658:= 649:{ 486:C 242:C 20:)

Index

Early exit
programming paradigm
computer program
control flow
if/then/else
while
for
block structures
subroutines
ALGOL 58
ALGOL 60
structured program theorem
Go To Statement Considered Harmful
Edsger W. Dijkstra
exception handling
structured program theorem
control structures
keywords
if..then..else..endif
while
repeat
for
do..until

three basic patterns
NS diagrams
flow charts
Subroutines
Blocks
ALGOL 68

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

↑