A novice programmer's support environment - Semantic Scholar

12 downloads 21725 Views 311KB Size Report
A novice programmer's support environment ... Department of Computer and Information Science ... Integrating Tech. into C.S.E. 6/96 Barcelona, Spain. Q 1996 ...
A novice programmer’s

support environment

Blaise W. Liffick Department

of Computer

Science

Millersville University Millersville,

PA 17551

[email protected]. edu Robert Aiken Department

of Computer and Information

Science

Temple University Philadelphia, PA 19122

[email protected]. Abstract

edu

programs down to the smallest piece of information possible. This would include dealing with lexical and syntactic issues which, while not generally a major problem students have with examples, can cause difficulty for the least able students. More often, a student’s problem is identifiable as a misunderstanding of the semantics of a particular programming statement.

This paper presents a model of how programming knowledge can be represented by five cognitive levels: lexical, syntactic, semantic, schematic, and conceptual. These levels are formed into a network of knowledge that can be used to annotate example programs for programming novices. The schematic level provides a new means by which semantics car-i be added to example programs for groups of statements, which collectively form programming plans. A hypertext environment which links each token and program statement in an example program to detailed explanations of their lexical, syntactic, and semantic significance is described. In addition, the schematic level provides a means of documenting the relationships of groups of program statements in a hierarchical fashion.

However, the largest problem for students appears to be in making the leap from an understanding of individual program statements to the tasks being accomplished by groups of statements. It appears that students often focus on examples using a microscope instead of just their own eyes. This narrow focus results in their missing the point of many of the examples being presented.

1 Introduction

2 The

Students have difficulties learning how to program for a variety of reasons. One reason appears to be that the pace of the presentation of new information in the standardl instruction model is not under a student’s control. As a result, if the student should fall behind in his or her understanding of the material being presented by the instructor, the likelihood is that he/she will continue to fall further behind.

Our approach is to first identify a cognitive model on which to develop an automated method of annotating example programs in such a way that students can access information about any aspect of the example that was preventing them from fully understanding it. This model is a synthesis of the interactive language model proposed by Foley, van Dam, et al [3] and the concept of programming plans as described by Soloway, Bonar, and others [1, 6]. The result is a definition of a cognitive model containing five levels of knowledge within the domain of programming: Lexical, Syntactic, Semantic,

A further observation is that textbooks, which can’t help but follow the same pattern of presentation of material as the instructors (or, perhaps, vice versa), suffer from the same difficulty,

especially

as regards

the use of example

programs.

In the case of examples,

students may stumble in their understanding of an example not necessarily because of their difficulty in grasping the newest concept being presented, but because they have failed to understand some previous concept that is still being employed in this new example. One approach computer-based

to dealing with this problem is to develop support system that documents example

model

Schematic, and Conceptual, The Lexical and Syntactic levels are self-explanatory. The Semantic level (as adapted to the programming domain) deals with the semantics of individual statements. The Schematic level, through the use of programming plans, allows multiple statements to be grouped into semantically meaningful knowledge units. The Conceptual level deals with definable functions within the problem domain of the application being programmed.

a

Permission to make digital~ard copy of part or all of this work for personal or classroom use is rantad without fee provided that copies are not made or distributed for pro ?It or commercial advantage, the copyright notice, the title of the publication and its date appear, and notice is given that copying is by permission of ACM, Inc. To copy otherwise, to republish, to post on servers, or to redistribute to lists, requires prior specific permission andfor a fee. Integrating Tech. into C.S.E. 6/96 Barcelona, Spain Q 1996 ACM 0-89791 -644-4/96/0009 ...$3.50

cognitive

This model serves as a basis for the annotation of example programs. These five cognitive levels have been developed into a network to support annotations (called ANNET) that are linked to example programs [4]. This network could form the backbone of a system that would allow the student to explore each example on any and all cognitive levels, entirely user directed. In other words, regardless of when a particular example program is presented to a student during a course, the student has the ability to explore that example by accessing on-line

counter to count the number of items in a list), level is particularly useful in understanding procedural languages.

annotations on any of the cognitive levels. For instance, while studying some example, if the student has a question about a previously explained programming statement contained within this current example, instead of hunting for some previous example in which that statement is the focus of attention, the student can request an elaboration of that particular statement from within the current example. This elaboration might be about the semantics of that particular statement, about its syntax, or about some token (e.g. an operator or identifier) within the statement. In addition, the student can explore how this particular statement is related to others within the example. For instance,

consider

theexample

given

in Figure

3 The

1, a Pascal

The Schematic level is represented by a library of plans. A specific program example is linked to this library by an The student user instructor using an authoring subsystem. accesses another subsystem to navigate the specific plans linked to each example. The plans linked to a specific example form a network which the user can traverse in order to access natural language annotations that describe the plans and their components. This network extends from the Schematic level down to the Lexical level.

The novice can use typical selection tools to identify the token, statement fragment, or statement(s) that are of interest. Once an item is selected, the user can be provided with an annotation that should help clarify the user’s difficulty in understanding the example. This annotation is simple text, for instance to explain that the ‘’ token indicates a ‘not equal’ condition. The annotation can also be a graphic, such as a syntax diagram. Finally, animation is used to demonstrate the semantics of a statement(s). 1:

Lexical,

syntactic,

1 program Accumdaton 2 var Total, 3 Amount: integec 4 begin

and

I flccumulator

Total := O; 4 . . write~ Enter m omounr ‘) read(Amount); while Amount 9999 do begin

5 6 7 8 9

10 11

Total := Total + Amount writeln;

12 13 14 15 16 17

write(’Enter an amount ‘); read(Amount) end writeln; writeln(’The total is ‘,Total) end.

Figure

The first are specific

2:

to a particular

Built-in annotations are associated with generic templates (based on each level’s type, e.g. plans for the Schematic level, a syntax diagram for the Syntactic level, etc.) which the instructor uses to document specific instances of program code contained within an example helshe wishes to add to the system. In addition to this library of pre-written annotations, each annotation can be modified to fit each instance of use. This modification can be done both automatically (as in the case of referring to a particular identifier) and manually (to allow the instructor to add his/her own comments). The collection of instances for a specific example form a network of nodes, with an annotation associated with each node. Students explore a particular example by accessing these annotations while traversing the network.

levels.

I

..-

~

Figure 3 shows a graphical representation of part of the network created for a particular example in Pascal. Networks are for the most part hierarchical. The root represents the most general information available about the program. It provides the boundary to the conceptual level of knowledge, represented by function-specific documentation. The terminal nodes represent knowledge about specific (single) statements within the example program, at the Semantic and Syntactic levels. These are known as plan constructs, and are thus marked with a ‘C’ within a circle. They represent specific statements within the programming language used for the example. The Lexical level is accessed through the selection of individual tokens within the program example. The plans network is thus arranged with the most general information available from the information from the top-most nodes, the most specific bottom-most nodes.

--------

}

An example program sample programming

three cognitive

semantic

levels

(Lexical,

programming

in Pascal, plans. Syntactic, language,

with

Semantic) and

system

The major feature of ANNET is the way programs are represented using the plans description, and how this creates the Schematic level of the network. Programming plans can be viewed as ‘standard templates and structures for accomplishing typical programming tasks’ [2, p. 335]. It has been suggested by researchers that a major difference between what novice and expert programmers know is how to better organize information into useful groupings [5]. It has been proposed that such organization can be accounted for by the notion of programming plans [6].

program. Some of the questions that a novice might have about this program might include how a particular token is formed (a lexical issue), the use of writebr with and without parameters (a syntactic issue), the anticipated result of, for instance, line 10 (a semantic issue), or how line 5 is related to line 10 (a schematic issue). Figure 2 shows two simple examples of programming plans, indicating that annotations are available to the user to describe the relationships of the indicated statements (this is not a typical view that a user would have, but only illustrates how plans work).

Figure

ANNET

the Schematic concepts in

follow

easily from the base definition of the language given, for instance, in syntax diagrams and grammar. The fourth, Schematic, is mostly generic. (The fifth level, Conceptual, is not dealt with in this paper.) The Schematic level defines how groups of statements relate to form semantic units that accomplish some task. Since, at the novice level, many tasks that need to be accomplished within simple programs are not language dependent (consider, for instance, the need for a

The plain rectangles in the diagram represent a specific programming plan, i.e. a means of accomplishing some goal. The rounded rectangles are goals, i.e. a task to be completed. Goals and plans alternate levels from top to bottom, with the bottom most level composed entirely of plan constructs. This diagram shows the Obtain Total goal being

50

satisfied by the User Input plan. This plan is further refined into goals to Prompt User and obtain Keyboard Input. The Prompt User goal is satisfied by the Display Prompt plan, which is finally instantiated using the write programming language construct. Note too that the Obtain Count goal is also satisfied using the User Input programming plan. This shows the reuse of plans within a single example. Although the plans library contains only one definition for the User Input plan, it can be used repeatedly to satisfy goals in any example of the. system, as well as multiple times within the same example.

4 Future

the of an the of to

One of the interesting side effects of developing such a system for novice programmers is that the system could also be used by any experienced programmer trying to learn a new programming language. Such a system might be packaged with a compiler’s help system, so that examples lused within tutorials could allow the user to request further information on any portion of any example program, from the lexical level to the schematic level. m

-1)

1user

J$EJ

compute

Input

Dlvis(m

I

I

; Ewes,,.. A,,,gnment

YT

II

Keyboard hp.! I

1

& &&& Figure

3:

The

hierarchical

+ Specialmd

nature

of

ANNET.

References 1

Bonar, J. and B. Liffick ( 1990). A visual programming language for novices. In S. K. Chang (cd.), Principles of Visual Programming Languages. Englewood Cliffs, NJ: Prentice-Hall.

3

Foley, J., van Dam, A., Feiner, S. K., Hughes, J. F. (1990). Computer Graphics - Principles and Practice (2nd cd.). Reading, MA: Addison-Wesley Publishing Co.

4

Liffick, B. (1993). A Programming Plans Paradigm for a Ph.D. Novice Programmer’s Support Environment. dissertation. Temple University. May 1993.

5

McKeithen, K., Reitman, J., Rueter, H., & Hirtle, S. (198 1). Knowledge organization and skill differences in computer programmers. Cognitive Psychology, 13:307325.

6

Soloway, E. (1984). A cognitively-based methodology for designing languages/ environments/methodologies. Proceedings of the ACM Symposium on Practical Software Development Environments.

plans

A small prototype of an annotation system built upon ANNET model has been developed, based upon a subset Pascal. The next major task is to develop the system for entire language, such as C++. It is interesting to note that development of objects closely resembles the notion programming plans, so C++ will perhaps be a ‘natural’ fit this cognitive model.

D8sPlay Prow!

2

Bonar, J. (1983). implementation. and Development Pittsburgh PA.

Plan epistemology: Tactics and Technical Report, Learning Research Center,

University

of

Pittsburgh,

51

Suggest Documents