Abstract
Through the development of a simple example, this chapter gives all the details necessary to appreciate the essentials of programming. All programs are simply a list of instructions that the computer will follow mindlessly. The instruction list may be reduced in length by making repeated segments into a single instance of a subprogram which can be re-executed any number of times. Other repeated instruction segments may be included in a loop structure that directs the computer to repeatedly execute the instructions included within it. Use of a loop structure introduces a branch point where the execution sequence may either go around the loop or not. This list of instructions, the program, then determines a complex flow structure (as the collection of all potential flow paths), but makes no effort to expose it. It is the flow structure (in conjunction with branch conditions and specific storage-box values) that directly determines the program behaviour that emerges. Stepwise refinement from program plan to programming language instructions is introduced and contrasted with ad hoc concoction of programs. Some program style guidelines (just COMMENTs and indentation as a layout feature) are introduced as an aid to human comprehension. Subprograms and loops reduce program size but increase flow structure complexity. Consequently, the programmer attempting to eliminate an error, or otherwise modify the emergent behaviour, can only work by rearranging the list of instructions but must think in terms of the flow structure repercussions.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
This true story is told at much greater length and with full details by Leonard Lee in The Day the Phones Stopped (Primus: New York, 1992).
- 2.
One important difference between programs and recipes is that programs are constructed to be followed precisely, whereas recipes will always (and are usually expected to) admit some latitude for interpretation. You never get precisely the same cake twice, but you should always get precisely the same computation from an unchanged program – however many times you require the computer to execute the program (to exercise the jargon).
- 3.
Mrs Beeton’s Household Management: a complete cookery book, by Isabella Beeton, Ward Lock: London. This famous nineteenth century tome of 1,680 pages, which ranges from cookery through to “servants’ duties”, has been through many editions and was a UK standard for decades.
- 4.
I employ the convention of underlining for all main program and subprogram names, and bold for the name itself where the subprogram is specified, but not bolded for references to the name. In this way we can visually distinguish between a subprogram name designating a segment of instructions as a subprogram , and a subprogram name that is an instruction for the computer to go to the named subprogram and execute the instructions it contains.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
Copyright information
© 2011 Springer-Verlag London Limited
About this chapter
Cite this chapter
Partridge, D. (2011). Cooking Up Programs. In: The Seductive Computer. Springer, London. https://doi.org/10.1007/978-1-84996-498-2_4
Download citation
DOI: https://doi.org/10.1007/978-1-84996-498-2_4
Published:
Publisher Name: Springer, London
Print ISBN: 978-1-84996-497-5
Online ISBN: 978-1-84996-498-2
eBook Packages: Computer ScienceComputer Science (R0)