http://wrap.warwick.ac.uk/
Original citation:
Alexander-Craig, I. D. and Thomas, R. F. (1987) Learning to program : a cognitive model for an ITS. University of Warwick. Department of Computer Science. (Department of Computer Science Research Report). (Unpublished) CS-RR-113
Permanent WRAP url:
http://wrap.warwick.ac.uk/60809
Copyright and reuse:
The Warwick Research Archive Portal (WRAP) makes this work by researchers of the University of Warwick available open access under the following conditions. Copyright © and all moral rights to the version of the paper presented here belong to the individual author(s) and/or other copyright owners. To the extent reasonable and practicable the material made available in WRAP has been checked for eligibility before being made available.
Copies of full items can be used for personal research or study, educational, or not-for-profit purposes without prior permission or charge. Provided that the authors, title and full bibliographic details are credited, a hyperlink and/or URL is given for the original metadata page and the content is not changed in any way.
A note on versions:
I{esearch
report
113
LEARNING TO PROGRAM:
A
COGNITIVE
MODEL
FORAN
ITSloin
D
Croig
&
Robert
FThomos
(RRr
r3)
Abslrocl
Programming
is
a complex
skill acquired
only
after
considerablepractice.
This
paperoutlines
a hierarchical cognitive modelof
problemsolving
andprogramming.
The modelaccc,-lnts
for
theway
students acquire programming knowledge and forms a basisfor
anintegrated problem solving
andPASCAL tutoring system. In
termsof
tutoring
sysrem design,it
addresses issues associatedwith
user-modelling and selection and developmentof
tutorial
strategies.--t
Deparnnent of Computer Science
University of
WarwickCoventry
CV47AL
LIiARNING TO
PROGRAM:
A
COGNiTTVB
MODEL
FOR
AN
ITS
I uin
D.
Craig and RobertF'
ThomasDepartrnent
^
of ComPuter ScienceUniversitY of
Warwick
CoventryCY47AL
UK
ABSTRACT
Programming
is a
complex
skill
acquired
only
after
considerable
practise.
This
paper outlines
a
hierarchical cognitive
model
of
problem
solving and
programrrting.
The
model
accounts
for
the way
students
acquire
programming
knorvledge
and forms
a
basis
for
an
integrated
problem
solving
and
PASCAL
tutoring
system.
In
terms
of
tutoring
system design,
it
adclresses issues associated
with
user-modelling
and
selection
and
developnrent
of
tutorial
strategies.
1.
INTRODUCTION
programming is a complex
skill
acquired only after considerable practise. This paper outlines ahierarchical cognitive
model
of
problem solving
and programrning
(in
this context' for
PASCAL
programming) rvhich is based on observations of novice progmmmers and protocolresults from experiments. The model accounts
for
the way students acquire domain knowledgeand programming skills, as w'cll as the clevelopmental process that occurs as a novice becomes
an expert.
It
predicts,n.
n i5ccrnceptions and problems that novices exhibit'section 3 of the paper considers the design issues that are addressed
by
using the model asa basis
for
an integrated problemsolving
andPASCAL
programming course' The importantissues discussed are the optinrisation
of
the knowledge acquisition plocess and the rransitionfrom
novice
to
expert.In
telms
of
tutoring
System design, theseinclude
usermodelling'
selection
of
appropriatetutorial
strategiesand
the
graphical
representationof
problem decomposition to improve understanding'2
THE
MODEL
In
this section, the psychological model '*'e are developing is outlined' The model is based onexisting
psychological theoricsof
problem-solving
(Johnson-Laird' 83; Gentner&
Stevens'g3:
Simon,79;
Gick
&
Holyc,ak, 80;carbonell,
83;Wickelgren,T4)
and learning (Norman'82).
It
provides a modelof
the learning process and is intended to accountfor
the transitionfrom
novice to
expert perfortrtancein
programming and provides a theoretical basisfor
thesystem we intend to develop.
It
gives an underpinningfor
the usermodelling
techniques weintend our
I'fs
to use.we
alsc,hope to be able to use the model to optimise the transitionfrom
novice
to
expert performance.
Finally, the model
suggestsa
structured
presentationof
materials: this contrasts
with
the current practiseof
lessons that present conceptsin
a vaguefashion and which require conrrretisation
of
concepts through programming lessons'The model we ale developing relates to the methodology we adopt in that the point
of
usingthe
ITS
is to develop programrning concepts rather than domain (i.e., programminglanguage-specificknowledge-forexarnple,syntax).Amoredetailedaccountofthemodelandits
justification
is to be foundin
(Craig&
Thomas' 87)'2.2
Model
The model
of
programming \I'e are developing is based on three collectionsof
mental modelswhich we
call
the problem,prLt$lsm-tolving
and domain models' The models form a hierarchyand each contains a number
of
smaller mental models to replesent the concepts and operatorsthe
student possesses.The nrodel hierarchy
is shown
in figure 1'
togetherwith a
simplerepresentation of the interactior-rs between models'
Theproblemmod,e|isthehighestmodelinthehierarchy.Itrepresentsthestudent's
understanding
of
the problem that has been set. This model contains concepts and operatorsneeded to understand the problem statement in enough detail to begin the problem-solving part
oftheprogrammingtask.InadditiontothoseconceptsandoperatorsrelevanttotheculTent
task, the problem model also has available to
it
all knowledge acquiredfor
previous
problem-solvingepisodes.Theproblemmodelcontainsrealworldandotherkindsofknowledge
brought
to
bearby
students when presentedwith
a newproblem
statementto
turn
into
aprogram.
When a problem statement has been understood,
it
can be convertedinto
aProblem
model
nding
I
I
problem
uP
roblem-so lving
model
progr
to
co,Domain
model
corrections
to
faulty
understa
nderstanding
trram
structure
ode
semantic
model
'm
ig ration'
Fig.
1 [image:5.595.60.446.101.633.2]problem-solving
model perfor ms the conversion. This model contains a representationof
theprog1am design expressed as lt subgoal hierarchy. Each major step
in
structuring the resultantprogram is represented as a subgoal. Subgoals are created and manipulated by problem-solving
operators, each
of
which
is represented
by a
sepalatemental
model
and
eachof
whichrepresents an abslract constrttction
or
a general-purpose operator' The representationfinally
produced
by
rheproblem-solving rnodel
is
a
structurewhich
canbe
directly
coded usingknowledge contained in the dornain model'
The domaiiz model contains
progranmling
language(in oul
case,PASCAL)
constructsrepresented
in
termsof
their
syntax and semantics. This model is the lowestin
the hierarchydepicted in
figure
1. The knor,i,ledge in this model is again represented as a collectionof
smallermental models, one per consrruct.
The
dornain rnodel represents the basic constructsof
theprogramming language being learned.
This
knowledge should be usedto
directly
code thesrructures produced
by
the problern-solving
model. Whenthe
subgoalhierarchy
has beenconstructed by the student, kntrwledge
in
the domain model is applied to produce a program'The
rnodeljust
outinedis
derived
from
observationsof
novice programmers andfrom
protocol experiments.
It
is alsct based on observations of expert progralnmers'Itcouldbearguedthaton]},twomodels(problemanddomain)arerequiredtoaccountfor
novice and expert behaviour. From
our
observations and experiments' we havefound
that arange of behaviours is exhibited which indicate that novices have
difficulty
in mapping problemstatements
into
correct code. We alsofound
that some novices attempt to produce code toorapidly
and do nor develop a t'ull understandingof
the problem before attempting to derive aprogram structure: as a result,
their
programs were either incorrector
incomplete-
this is
aproblem that PROUST (Johnson, 86),
for
exarnple, cannot address.We
have observed, thatfor
novices, problem-solvingis
shallow andfrequently
syntax-driven: they do not attenlpt to tlse the semantics of programming constructs
in
their attempts toderive programs from problenl statements, but instead attempt to match programming language
constructs syntactically against parts of the problem statement' Experts'
on
theother
hand'move
from
problem statement to codevia
an intermediate stagein which
problem-solving isopportunitytosetsubgoalsatagivenlevelofabstractionandtoperformaselectivebreadth-first
expansionof subgoals.
'typically,
expert
proglammerswill
selectmore important or
difficult
subgoalsfor
attentioll before they attend to easier or less important ones' Novices tendro engage
directly in
adepth-first
expansionof
the subgoalsthey
have generated' Novicesexhibit
shaliow problem-solvirlg because they do not appeal to have the abstract concepts andoperatorsavailabletoexperts:theyworkatalevelfarclosertothecodetheyaretoproduce.ln
other
words,
theproblem-solving model
possessedby
novicesis deficient
in
higher-level
constructs than is that possesscd by experts'
Thedevelopmentoracquisitionofconstructsandconcepts(mentalmodels,inourterms)is
an explanation of the passage l'rom novice to expefi' The domain model of a novice contains the
Syntax and semantics
of
eletrrentaryplogramming
constructs'InitiallY' we
would expert
acomplete novice
to
poSSeSSonly
those
Syntactic constlucts encountered
so
far
in
theprogramming course together
with
a superficial account of their semantics' since theproblem-solving model is defrcient, the
ransition
from problem statement to code can only be mediatedby comparatively superficial
froblem-solving.
with
experience, we suggest' the semanticsof
constructs becomes better untlerstood (and hence, the
nental
model which
represents eachconstruct,s semantics becomes more developed). The development
of
the semantics allows theconstruct to be abstracted and used as an operator
in
the problem-solvingmodel'
In
addition'
more complex constructions (1or example, formatted inpuQ are encountered and are turned into
abstract operators that can be rrsed
for
problem-solving'One
significant differencc
between expelts and novicesis
that experts are ableto view
programs at absract levels
of
representation. For example, an expertmight view
a module asrequiring
a set rather thanviewing
it
as some programming language-specific data structure(e.g., an
anay). In
termsof
otrr model, the expert has a mental modelof
setsin
hisproblem-solving model and is able to Llse this more abstract operator in program design' The acquisition
of
such higher-level and morcpowerful
operators and representationsin
the problem-solvingmodel
is
partof
the wayin
rihich
that model develops and affords theopportunity to
solveproblems using
deeperinfercnce than
doesthe novice' The acquisition
of
more
abstractdifferent
contexrs andin diffcrent
problems: oneof
our experimentalgroup
stated that shefound constructs easier
to
untlerstand after she had used them. The'migration'
of
semanticsfrom
domain
to
problem-solving models
(whereit
is
used aspart
of
the
problem-solving representation) is another facetof
this developnent process.Because an expert's
problcm-solving
model is more complete and contains more abstractand powerful representations, tlie interactions between problem and problem-solving models in
expert performance are more
complex.
Novices, as has been noted,tend
to
produce codebefore the problem is understc'od and before a design has been achieved. Experts, on the other
hand, spend more time understiinding the problem and attempting to produce a design in terms
of
a subgoal hierarchy. Problern understanding is done using the problem model. Novices, wehave observed, engage
in
alitrle
code-writing andfind
that they can make no further progress,whereas experts defer coding
until
as late as possible. We suggest thatthis
is due,in
part, tothe
interactions between
the
problem and problem-solving models: deficiencies in
understanding the problem stafement can be detected during problem-solving and before coding
if
problem-solving is
the mainactivity
after coming to gripswith
theproblem
statement.In
other words, experts tend to use the problem-solving model as a way
of
isolating deficienciesin
their
understandingof
the problem: when deficiencies are detected, the problem model isused
to improve
theproblem
representation so thatit
can be usedby
the problem-solvingmodel. Because novices do not possess powerful enough absrractions, they
find
this processharder to perform.
2.3 Summary
of
Experimental
Results
As has been stated above, thinking-aloud protocols have been taken
from
members of a smallvolunteer group
drawn from
rrurFirst
Year students. The protocols were taken after we hadcompleted a
period
of
obsen'ationduring which
we watched participantsin
an elementarycourse
for
students who come toWarwick
University to read Computer Science but who haveno previous experience of programming. We found confirming evidence
for
our model in theprotocols. In particular, we found the effects of problem understanding and problem-solving to
be
in
agreementwith
our
predictions.
We
alsofound that
subjects whose programmingfashion when confronted
with
a new problemto
solve, whereas thosewith
more experiencetended to employ more absffacL conceptions of programming concepts.
3.
IMPLE}{ENTATION
OF
THE
MODEL
3.1,
Introduction
This
section describes aframcwork
for
atutoring
systemfor
problemsolving
andPASCAL
programming.
It
is basedon
rhe model outlinedin
section 1, and addresses important designissues raised by other ITS projects'
3.2
Design
philosoPhY
The design
philosophy
of
our
systemis built
around the whole programming course, ratherthan the tutoring system, and so contains several different teaching modes.The overall aim is to
teach both problem solving shills and program design, which are generic to programming, and
PASCAL programming.
The system aims to provicle two modes of interaction
with
the student, a teaching mode anda coaching mode.
The teaching mocle teache s
PASCAL
concepts, adopting a one per lesson strategy (Burton82).
This
constrainsthe
teachingdomain,
so thatthe
system canmodel
the
student moreaccurately in the constrained domain, and can provide more
flexibility
in its teaching strategies.At
the endof
the lesson, once the student has learnt and understood the concept, they interactwith
the computer to create a "conceptbox",
which contains parameters which can befilled
todescribe the application
of
thcPASCAL
concept. When the student hasbuilt
up aportfolio
of
boxes and completed the novice
PASCAL
concepts section, they enter theproblem
solvingmode.This mode provides a lcarning environment
in
which the student isgiven
a problem tosolve, and is able to develop a plan, and then code
it'
The problem solving modc provides a graphics interface which allows the student to build
up a goal decomposition diagram,
in
a hierarchical tree representation.It
contains a problemsolving
coach which
provides help, bothin
sfructuring the problem, andin
teaching problemsolving strategies. This approrch ensures that the system has an understanding
of
the student'sbyproduct
of
the
lesson, and since the programmingtutor
has ensuredthat the
student hasdeveloped a good understanding
ofthe
concepts, then the problem solving coach has an exactunderstanding
of
the semanticsof
the subgoal boxes. This method has several advantages overother techniques that have bee n developed to understand or teach problem
solving skills'
Themain advantages ale
in
thefollowing
areas.3.3
User
Model
The
usermodel is
the the most important, and the most challenging aspectof
a tutoringsystem.
It
is the
system's representationof
the student, and hencethe
basison
which
anyteaching strategy is selected.
problems highlighted through research in this area prinrarily concern the need to be able to
pinpoint the
level
of
a studenr's misconception. Our system is based on a three level modelof
the process by
which
a student creates a proglam' given a specific problem.During the problem solving mode, when the student is given a question, the notation of this
question
is
animportant
fact()rin
governinghow
the student develops a representation, ormental model,
of
the progranr (Craig&
Thomas, 87). The presentationof different
notationsfor
the
same question,ie
a nrathematical question versus a realworld
example, provides anindication
of
a student'sabilirl,
to represent problems.It
also provides a methodof
coachingproblem representation,
which
is a common problem with novice programmers'During
the goal decomposition process, the student uses the boxes they have developed tocreate
a
subgoal
diagram,or
solution plan.
Since the system has an understandingof
theser'antics
of the "goal
boxes",it
can understand the goal decomposition process. Thusit
cancoach the student
with
anyproblens,
and also tolerate the many possible waysof
planning asolution.
Two ITS
sysrems already tleveloped outline someof
thedifficulties
of
understanding goaldecomposition.
SpADE
(Miller
78) provicles a sophisticated graphics interfacein which
a planfor
a turtlegraphics program can be developed, using graphics boxes. The student uses a
list
of
definedoperators to create box types, but,
within
the boxes, can type comn-lentsin English'
AsMiller
to provide advice on goal decc'rnposition and debugging'
Another feature is that thc coaching module
will
contain all possible waysof
planning theprogram.
PROUST (Johnson. 86) is a commercially available system thatfinds
non syntacticbugs in
PASCAL
programs. 'l-he system uses a problem description (a subgoal decomposition)which the tutor types into the program
in
an authoring language. Howeverwith
atl but the mosttrivial
programs, there ale sevcral waysof
decornposing the problem'Another
point
which isoutlined
in
section
2 is that
novice
programmersoften misinterpret the question'
or
stafiprogramming
without
understilnding the question.our
tutoring frameworkwould
ensure thatthe student had a proper problt-rn representation, before coding was undertaken'
After
the sub goal diagram has been developed, the srudent canfilI
in the parameter fields inthe
individual
boxes. The sysrorn can then check the student's understandingof
thePASCAL
syntax and the
flow
of data.3.4
Tutoring
Module
The task
of
atutoring
module is to choose the best wayof
teaching a concept'or
correcting amisconception.
on
a more gcnerallevel,
it
should optimiseboth
theacquisition
of
domainknowledge and the transition from novice to expert'
The implementation
of
our learning model addresses the student learning issue on a moregeneral level. Teaching
PASC.{L
Concepts as mental models, or concept boxes, affords severaladvantages.
It
optimises the
learningof
PASCAL
conceptsby
providing
modular
conceptlessons
which
atiow
the studcntto
create and expandPASCAL
concept boxeswith
limited
parameters. These boxes cart then be used as operatols
in
theproblem
solving
process'In
terrns
of
optimising
the acqtrrsitionof
domain knowledge,our
models approachallows
thestudent to
build
upon concepts already learnt, by adding more parameters to the concept box'As
anovice
becomes more experienced at programming, he combinessimple PASCAL
concepts into more abstract operators, performing more complex tasks' This approach aids the
student to combine the boxes they have already created into more complex task boxes' allowing
them to
focus
on the problem tlecomposition process, rather than on thePASCAL
syntax'A
problemwith
teaching strategies has been how to structure the domainto minimise
theModularising
the lessons andsplitting
the teachingof proglamrning skills
and problemsolving
skills
allows the develtrpment of precise tutoring strategies, based on the performanceof
the student
within the linrited
domainin
which
he
is working' Building on skills
andknowledge
already
learnt
uill
reducethe likelihood
of
the
student
displaying
complex misconceptions due to the intcraction of misunderstandings at several levels.It will
also allowthe rutor to focus on particular remedial action should the need arise'
3.5 User
Interface
In
the
domain
of
program dcsign
andproblem solving, the
useof
graphics'
to
show themodularity
and hierarchical st|ucture, bothof
a problem solution and a program structure' is apowerful teaching aid.
During
the problern solvfurg mode, an interactive graphicsfacility
will
allow
the student toselect
problem solving
boxes. and to insert theseinto
the goal hierarchy' This representationallorvs the student to visualise important problem solving heuristics, as
well
as understandingthe narure
of
problem decomposition'4
CONCLUSIONS
This
paper ourlines apilot study
to develop the basisfor
aPASCAL Tutoring
System' Therarionale behind the system is to teach general programming skills,
including
problem solvingand progtam design, and also ro teach the syntax and semantics of
PASCAL'
The study buildson issues
that
stateof
thean
ITS
systems have outlined and provides a modelwhich
can beused
to
develop
lessonmaterial
andtutoring
strategies and alsoto provide
the basisfor
acomprehensive student model.
The
next
stagewill
beto
developfurther
experiments.Firstly to
evaluate theeffect
of
teaching strategies on differetrt levels
of
misconception and secondly to investigate the useof
the question syntax
asa
merhodof
teachingproblem
representationskills'
work
is
alsounderway
on
anintelligent
graphics interface,allowing
a menu based selectionof
conceptboxes.
REFERENCES
Burton R.R. (82) Diagnosing hugs in a simple procedural
skill,
in Sleeman&
Brown (82)'Experience,
in
Michalski,
R.S., Carbonell, J.G. andMitchell,
T.M',
Machine Learning:An
Artificial
Intelligencc Approach, Tioga Press, PaloAlto,
CA'
1983.Gentner
D.
and Stevens,A.L. (83) Mental Models, Lawrence Erlbaum
Associates, London,1983.
Gick,
lr{.L.
andHolyoak, K.J.
(80) Analogical Problem Solving, CognitivePsychology,Yol.
12,pp.306
-
356,
1980.Goldstein,
I.p.
(g2) The
Genc,tic Graph: A Representationfor
the Evolution
of
ProceduralKlowledge,
in
Sleenlanlnd
Brown (82).Johnson
w.L.
(g6) Intenrion based diagnosis of novice programming errors, Pitman , London.Johnson-Laird, P.N. (1983) I\'lcntal Models, Cambridge University Press, 1983'
Miller M.L.
(78)
A
srructrrred
planning and
debugging
environment
for
elementaryprogramm ing, I nt. J . M tt n- M ac hine S tttdie s I
I'
7 9 -9 5'Norman,
D.A.
(S2)trarning
and Memory,w.H.Freeman
andco.,
san Francisco, 1982.Simon,
H.A.
(79)
Information-Processing Theoryof
Human ProblemSolving,
in
Estes, W.(ed.) Handbook
of
Learning
and
Cognitive
Processes,Vol.
5,
Lawrence
Erlbaum Associates.London,
1979Sleeman
D., Brown
J.S. (eds.) (82) Intelligent tutoring systems, Academic Press, [,ondon.Wickelgren
W.A.
(74) How to
Solve Problems,W.H.
Freeman andCo.,
San Francisco'197 4.