CSE 130 Lecture Notes - Lecture 14: Exception Handling, Donald Knuth, Computable Function

39 views4 pages
28 Feb 2018
Dijkstra’s “Go To” criticism
-go-to’s are BAD
-new high-level control flow constructs
-why is it bad?
-there is NO structure! You can basically jump anywhere
- we don’t know WHERE we will end up!
Donald Knuth
1. Eliminate gotos in some cases
2. Add gotos in other cases (i.e. in controlled form)
- Helps simplify code (can jump to labels for error checking, for example)
Structured Programming
-a paradigm - has things like “control flow” statements
-includes things like control structures, procedures, blocks, etc.
- Makes code less gnarly (easier to write)
- Helps simplify certain areas where there can be potential faults
Programming w/ Gotos
-largely unstructured control flow graphs
-extremely flexible!
-Control flow graphs (CFG) - graphs that describe “control flow”, where programs go, can lead
to, and flow from
What constructs do we need to express ANY computable function?
A: sequencing of instructions, selection (aka conditional branching), iteration (looping)
CFG of sequencing
→ | | | | jump, or branch
CFG of if-else
| | | A | | |
| B | | C |
If A then __
Else B
CFG of “do” - while loop
| | exit
← loop back around
While loop
Unlock document

This preview shows page 1 of the document.
Unlock all 4 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Notes+

Unlimited access to class notes and textbook notes.

YearlyBest Value
75% OFF
$8 USD/m
$30 USD/m
You will be charged $96 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.