Home
 

Structures and Plans

Structures and Plans

First, we need to introduce two terms that turn out to be important: Structure and Plans.

Structures

A structure describes the way something is build. For our analysis we distinguish between syntactic and semantic structure, as identified by Scholtz and Wiedenbeck ([2], [3]). The syntactic structure refers to the syntax of a programming language, for example the characters needed to start a comment.

The semantic structure refers to the semantic of a programming language, for example if a variable needs to be declared or not or if the function read() reads a whole line or a single character.

Plans

A plan is, in simple terms, how someone intends to do something. For our analysis we have strategic, tactical and implementation plans, as identified by Soloway et al. ([12]). The highest level of abstraction is the strategic plan. At this level we are language-independent and only concerned with the basic idea of doing something. An example would be the main loop of a server: Get request, process it and start over again. Even such high level things like incremental programming fall into strategic planning.

The tactical plan is more detailed, but still language-independent. It is a local strategy or algorithm for solving a problem.

Finally, the implementation plan is at the level of the programming language, i.e. the actual constructs a programmer would use to implement the language-independent tactical plans. Note that this is still somewhat above the syntax and the semantics we described above. Programmers don't worry about "should there be a semicolon or not," but for example think about "is there a loop construct to iterate over a list?"

For example, say we want to translate all uppercase characters to lowercase characters. A strategic plan may look like this.

loop
   read character from input
   translate character
   write character
Another example might be.
loop
   read line from input
   translate characters in line
   write line
A tactical plan for the first example is.
while (characters on input)
   read character
   if character is uppercase then translate to lowercase
   write character
And for the second example.
while (lines on input)
   read line
   translate all characters in line to lowercase
   write line
Further refinement leads to an implementation plan, e.g. for the language C.
char c;
while (c = getChar()) {
   print("%c", tolower(c));
}
Or for example the second in Perl.
while(<>) {print lc}
Of course, there are lots of plans to solve the problem.