Browse Prior Art Database

ON CONTROL CONSTRUCTS FOR CONSTRUCTING PROGRAMS

IP.com Disclosure Number: IPCOM000128001D
Original Publication Date: 1977-Dec-31
Included in the Prior Art Database: 2005-Sep-14
Document File: 4 page(s) / 19K

Publishing Venue

Software Patent Institute

Related People

Roy F. Keller: AUTHOR [+3]

Abstract

Two very specific control constructs, incase and forcase, are motivated and defined. Two examples are given to demonstrate the effective use of these constructs in program readability and clarity. These examples are taken from IZernighan and Plauger's books C7,81, however, almost any of their examples could have been used for demonstration. Key Words and Phrases: Refinement, structured programming into programming, control constructs, parallel processing, programming. *This work was supported by the U. S. Energy Research and Development Administration under Contract No. W-7405-eng-82.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 31% of the total text.

Page 1 of 4

THIS DOCUMENT IS AN APPROXIMATE REPRESENTATION OF THE ORIGINAL.

ON CONTROL CONSTRUCTS FOR CONSTRUCTING PROGRAMS*

by

Roy F. Keller

Technical Report #77-1 January 1977

On Control Constructs for Constructing Programs*

Roy F. Kelley Iowa State University Ames Laboratory, ERDA

Abstract

Two very specific control constructs, incase and forcase, are motivated and defined. Two examples are given to demonstrate the effective use of these constructs in program readability and clarity. These examples are taken from IZernighan and Plauger's books C7,81, however, almost any of their examples could have been used for demonstration.

Key Words and Phrases: Refinement, structured programming into programming, control constructs, parallel processing, programming.

*This work was supported by the U. S. Energy Research and Development Administration under Contract No. W-7405-eng-82.

1. INTRODUCTION

In a number of publications [1,2,3,4,51 a case is made for programming "into" a programming language and also ideas for teaching "into programming" are presented.

The whole issue of into programming, which includes structured and/or modular programming, centers around what data structures and control constructs should, or may, a programmer use as the programmer is thinking and constructing a program. He should feel free to go beyond the constructs of any programming language.

In [S1 a case is made for the general control constructs; if-then, if-then-else, while-do, repeat- until and repeat-exit. These constructs are beyond any given programming language for in their most general form any value type is permissible. For example a programmer should feel free to write a statement such as: while color is red do end while

without worrying if a given programming language has a value type of color. If a language does fine, that language may be chosen; if not, a color value type can be simulated in further refinement steps.

In this paper two more control constructs are presented, a forcase and incase.

Iowa State University Page 1 Dec 31, 1977

Page 2 of 4

ON CONTROL CONSTRUCTS FOR CONSTRUCTING PROGRAMS

2. The Incase and Forcase constructs.

Many programming languages have a case statement as a control construct. Such a statement is clearly motivated by the variety of uses of cases in a mathematical sense. For example, we commonly write for Case 1 do something Case 2 do something etc.

In a most general way a construct such as Dijkstra's i~-fi [61 (which he calls an alternative construct) covers almost all alternative selection one needs for programming including "nondeterminancy", and if-then and if-then-else constructs. t is clear in constructing programs we are often faced with a decision where it is desired to select exactly one from many (more than two) cases (or alternatives). A nested if-then-else of course can be used, but, it has been pointed out explicitly many times that nesting creates problems for constructing and validating programs. Thus for program clarit...