Weitere Kapitel dieses Buchs durch Wischen aufrufen
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.
Bitte loggen Sie sich ein, um Zugang zu diesem Inhalt zu erhalten
Sie möchten Zugang zu diesem Inhalt erhalten? Dann informieren Sie sich jetzt über unsere Produkte:
- Cooking Up Programs
- Springer London
- Chapter 4
Neuer Inhalt/© ITandMEDIA, Product Lifecycle Management/© Eisenhans | vege | Fotolia