Fernanda Brito Correia and Anabela Gomes Polytechnic Institute of Coimbra fernanda isecpt anabelaisecpt Agenda Programming learning difficulties The study Results analysis Conclusions ID: 344726
Download Presentation The PPT/PDF document "ERRORS TO AVOID IN PROGRAMMING TEACHING ..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
ERRORS TO AVOID IN PROGRAMMING TEACHING AND LEARNING
Fernanda Brito
Correia and Anabela Gomes
Polytechnic
Institute of
Coimbra
fernanda@
isec.pt ;
anabela@isec.ptSlide2
Agenda
Programming learning difficulties
The study
Results analysisConclusions
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
2Slide3
Programming learning difficulties
There are high failure rates in programming courses
The
inherent difficulty of programming
Programming languages have a very complex syntax with characteristics defined for professional use and not with pedagogical motivations
Student’s
cognitive abilities and
attitudesStudents lack of programming skills (abstraction, generalization, critical thinking, problem solving techniques,…)Inadequate teaching methodsInadequate studying methodsThe technological complexity involved in computer programs development…
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
3Slide4
Programming learning difficulties
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
4
In
general we agree that all these factors can contribute
to their failure
We proposed a new methodology to change the panorama
It is in this perspective that we present this
work, focusing indirectly on the study methods and including different assessment
strategiesSlide5
The
s
tudy
Took place in
2012/2013
academic
yearInvolved 65 students enrolled in the Biomedical Engineering degree of the Institute of Engineering (ISEC) of the
Coimbra Polytechnic Institute (IPC)
Focused
on the introductory programming course of the 1
st
semester of the 1st year
This
course uses the C language, followed by a 2nd semester course with C# and object oriented concepts
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
5Slide6
The study
Subjects covered
include
the basic concepts taught in an introductory programming course using a procedural programming language.
Data types, operators and expressions, standard input and output formatted data, data structures, functions, arrays and string manipulation.
In this course we use C language, but in the first three weeks students solve programming problems using sequential, selection and repetitive structures through
pseudocode
.Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
6Slide7
The study
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
This
course has
4 contact
hours per
week in two groups of about 30 students
each1 hour of theoretical class3 hours of lab classes
In addition teachers offer 6 more hours per week to clarify students’ doubts, during the entire semester.
7Slide8
The study
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
From
2011/2012 academic years
onwards, we have been studying the problems students face when programming.
The data
analysed
was collected during the classes and also by analysing the exams. The study intends to analyse the most significant problems faced by the students and also some
applied strategies intended to surpass the main problems detected.
8Slide9
Taxonomies of errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
Some taxonomies…
S
yntactic errorA violation of the syntax, or grammatical rules,
when using a
programming
languageSemantic errorA misuse of a programming concept, despite correct syntactic structure. Runtime exceptionAn error that occurs when the program is syntactically correct, but some “illegal” operations occur when the program is
being executed.Logical error
It
occurs when the program does not solve the problem that the programmer meant
to
solve
.
9Slide10
Syntactic errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
In an initial phase
,
the more frequent, less serious and more easily correctable syntactical errors
O
mission of a semicolon at the end of the statementIncorrect semicolon in a place not permittedThe
adding of a semicolon in the header of a function definition or at the end of a repetitive structure for when it is not supposed to beA
comment not
closed
A
mismatching, miscounting, and/or misuse of { }, [ ], ( ), “ “ and ‘
‘Many of the syntactical errors are simple mistypings.
10Slide11
Syntactic errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
Using
semicolons to separate arguments in a function
callThe
use of wrong separators in
for
loops (using commas instead of semicolons)The use of parenthesis instead of brackets in the vectorsUsing
keywords as function names or variable namesUsing the same name for
a function and for
the variable used for its
return
value
I
nvoking
functions with wrong arguments or feature call errors (wrong type or number of actual arguments, calling a non-existent feature,…), forgetting parenthesis after function call or forgetting parenthesis in conditions.Confusion between && vs. & and | | vs. |Forget to declare variables or wrongly spelled them in the
declarations.Wrong notations when using arrays
11Slide12
Syntactic errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
As the course goes on
,
among somewhat frequent, but more serious, however easily correctable syntactical
errors
M
any problems with the use of scanf statementShuffling some formatting with the printf
statement. We consider that the above-mentioned errors can be avoided with study
, understanding and consequent memorization and practice. Initially it would be desirable that the student manages a way to list such problems, especially the ones he
/she
commits, in order to avoid them
.
12Slide13
Syntactic errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
Until the end of the
course
the more frequent, but more serious and
hard to correct
syntactical errors
areThe ones associated with the use of functions and stringsIn respect to functionsT
he invocation of a void function in a statement that requires a return valueA
missing return at the end of any
function
I
n
function parameters: confusion between declaring parameters of a function and passing parameters in a function
call;
incompatibility between the declared return type of a function and in its callill-use of a function call
13Slide14
Syntactic errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
Until the end of the
course
the more frequent, but more serious and
hard to correct
syntactical errors
areIn respect to stringsThe use of ‘ instead of the “(quotation marks) or in the use of “ with incorrect formats.Difficulties
in understanding the difference between a character and a set of characters, at least in the string manipulation. If we declare a char variable
with
the name c, they have difficulties understanding what
are the
c variable, the c character and the
%c
are.
They also try to read a string to a char or to an int variableThey also use format
specifiers like %c or
%d
for the reading and writing of
strings
14Slide15
Syntactic errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
Until the end of the
course
the more frequent, but more serious and
hard to correct
syntactical errors
areIn respect to stringsThey define strings with specific C functions for instance with puts
They declare strings
but forget to mention
their length
They run
through a string from the first character to the supposed element stored at the maximum size instead of its string
length
T
hey misuse the specific C functions, such as toupper, gets,
puts, strlen besides
others
T
hey
compare strings with the equality
operator
They create
very different notations for instance
to access string elements
However
, the main
difficulties
students have with strings
usually have a
logical nature
.
15Slide16
Semantic errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
The
main semantic errors reveal themselves during the execution of
programsThe most common relate to the loss of value in assignments due to improper data types or a casting using different data
types
Example:
float f; scanf(
"%d", &f)T
he
use of a variable before its initialization or dividing a value by zero
16Slide17
Semantic errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
T
he
majority of semantic errors occurs when students begin to work with vectors and try to access
elements outside the space reserved for
them
We consider that such errors can be avoided with practice. We also recommend that, initially, the student arrange a way to list such problems and subsequently avoid them. Good advice would be to pay attention to the error and warning messages, usually useful in these situations
17Slide18
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
Logical errors are the most frequent and those in which students have more difficulty correcting. The compiler cannot detect this type of error, as the syntax is correct and the compiler checks only for
the syntax
In an initial phase
,
among the more frequent, less serious and more easily correctable logical errors
are the ones related to the misleading of what is happening“My program does nothing”We consider that such problems could be minimized if students at least structure the program through messages in a clearer manner as a way for the user to know what is happening
18Slide19
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
They use unfriendly interfaces that lead to misunderstandings of what the program does and what their mistakes
are
Their programs ask for data in an unclear way or
do not
ask the desirable format for data
entryWe believe that the inclusion of appropriate messages in key points where students can check the flow of the program will be a valuable aid, during the time they don’t know how to use the debugger
19Slide20
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
Use of the operator "=” instead
of "=
=“S
tudents many time sh
ave
difficulties understanding what is being asked, they don´t understand the question description.It is fundamental that, before students start to solve the exercises, they should have a complete understanding of what data is required for the problem as well as what results are expected.
20Slide21
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
We advise students to be completely enlightened about what to do before trying to start doing
it
The teacher could also help students, especially in this initial phase, showing an example of the required output after the execution of the
program
It is frequent in these situations that the student make the program to fit only the data presented by the teacher and write the program around the given input
21Slide22
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
With the on-going course
,
sometimes more frequently serious yet easily correctable logical errors occur with the use of
selections
They have
trouble defining conditions, particularly when they are composedWhen they have nested selections they have doubts in realizing which IF an
ELSE belongs toThey
also have doubts in completely
understanding
the
ELSE
T
hey have difficulty understanding the negation of a condition especially if it is a composed one
For that we suggest a revision about logical and relational operators and the correspondents’ truth tables.
22Slide23
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
With the on-going course
,
sometimes more frequently serious yet easily correctable logical errors occur with the use of
selections
C
programming language enables short intentional notations such as c+=1, ++c or c++
for c=c+1 and
s+=c
for
s=
s+c
The
novice programmer not familiar with this notation becomes
confusedSo we do not advise the use of short notations until a complete mastering of the subject
23Slide24
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
With the on-going course
,
sometimes more frequently serious yet easily correctable logical errors
occur with the use of
selections
Confusion between the quotient and remainder operatorsConfusion in purely sequential problems with assignment operators, assigning i to j when they meant assigning j to
iAnother problem is about the use of wrong indentations.We suggest students to indent
the
program correctly as a way to avoid logical
confusions
24Slide25
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
Until the end of the course
,
the more frequent, but more serious, problematic and hard to correct
logical errors
are those involving repetitive structures (cycles
)The for structure is more problematic than the while
They use the wrong order of the three components of the
for
T
hey
forget to use "{}" when there is more than one statement to include in the repetitive
structure
25Slide26
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
Until the end of the course
,
the more frequent, but more serious, problematic and hard to correct
logical errors
are those involving repetitive structures (cycles
)The wrong indentations usually confuse them easilySometimes they put instructions out of the loop when the intention was that they were part of the cycle
Other times, they use results and put instructions inside the loop that should be outside
26Slide27
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
Until the end of the course
,
the more frequent, but more serious, problematic and
hard to correct
logical errors
are those involving repetitive structures (cycles)Frequently, students also have code that is locally correct, but globally incorrect in the context of a loop producing negative interactions between sectionsOther
times, students put the code that is right but in the wrong place, this happens mainly when they have a loop inside anotherThis has a consequence of the updating within the loop when it should have been done
outside
Other times,
the updating should be done and it is
not
Other
logical errors which lead to adverse side unanticipated problems relate to the use of the same control variable when there is a cycle within another
one27Slide28
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
Until the end of the course
,
the more frequent, but more serious, problematic and
hard to correct
logical errors
are those involving repetitive structures (cycles)A badly written for or while statement, due to which the same loop executes infinitely due to a bad condition or an incorrect update of the expression that enables the loop to progress to the next
iterationSometimes, wrong usage of a semicolon
can lead to unexpected output, for instance
at the end of
the line of a
for,
example
: for
(k=1;k<=5;k++);
28Slide29
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
I
ncorrect initializations
/updates within the loops or incorrect declaration of variablesIncorrect update
of a variable in a
loop
Students make more errors and more frequently, when using the repetitive structure for than when using a
whileWe suggest that teachers first present the structure while
and then make its mapping to the
for
structure
We think that this latter structure makes it more difficult to understand because all expressions are concentrated in the same space (instruction) misleading its temporal occurrence
29Slide30
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
M
ore
serious is when students do not realize the need
of a
cycle, using
a selection insteadStudents make confusion between the index and the element of vectorsLots of logical difficulties manipulating stringsSpecially when they have to manipulate words in a string
Lots of difficulties manipulating functionsInteractions between local, static, global variables and parameters are complex subjects, which cause a lot of logical errors in the context of
functions
They confuse the space storage, the initialization and the visibility of
variables
30Slide31
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
S
tudents
usually don’t reveal difficulties in the
switch
instruction, when used in a traditional wayWhen used in an uncommon approach the student doesn’t completely master the behaviour of each one of its
componentsExample:What values should be given to the a and b variables (
in the
following code)
as a way to show the following messages “Hi
Folks”
and “Hello World”
?31Slide32
Logical errors
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
…
printf
("
Valores
para
A e B: ");
scanf
("%d %d", &a, &b);
switch(a)
{
default
:
printf
("Hello ");
case
2
:
case 3:
if
(b > 2)
printf
("Hi ");
case
4:
if
(b <= 1)
case
5:
if
(b < 4)
printf
("
Folks.
");
break
;
printf
("World.");
}
if
(a==1&&b >0)
printf
("World.")
;
…
32Slide33
Incomplete or
inefficient
resolutions
Students rarely bother with refinements of programs, being satisfied when they can carry out the generality of a program, ignoring
details
They do not
include part of the problem
specificationThey also do not check for special casesThey
forget to do the tests to achieve the permitted lower and upper bounds for the input dataThey forget to set conditions to allow
the acceptance of
only valid
values
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
33Slide34
Incomplete or
inefficient
resolutions
So we
recommend that,
w
hen students start to make the first resolution, they shouldn’t concern themselves with particular details of the problem in order to concentrate on the main features or small parts of the problem.
However, when a solution is given, students should improve it and verify all the missing details.
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
34Slide35
Incomplete or inefficient resolutions
Inefficiencies by not using functions and repeating code
Inefficiencies by not separating
the code between the calling and called
functionsInefficiencies in selectionsEstablish an
if
condition and later,
rather than placing a condition contrary in an else, they put another if condition with the contrary condition
Inefficiencies using extra and unnecessary variables These problems are easy to overcome with the programming practice
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
35Slide36
Empty resolutions
S
tudents
do not understand the problem description or the task at hand
They don’t know what the program is supposed to do
The teacher should present
an example of an execution of the intended
programStudents usually make a solution that only works for the data presented by the teacher, limiting the program to work only with the presented example and not being general for any input
data
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
36Slide37
Empty resolutions
Other
times,
students understand the task but can’t turn that understanding into an algorithm or
solutionIn particular if the program involves the use of mathematical functionsStudents
should search everything that can help the resolution, including the teacher or previous
exercises
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
37Slide38
Recommendations for teachers
Teachers should
use a set of strategies to facilitate student
learning, besides the ones already mentioned
Carefully choose the sequence of exercises to be solved in each class and throughout all classes
E
asily
and quickly adapt a problem description to the knowledge and difficulties of each studentUse clear terminology and clarify its meaningImplement continual evaluation
Monitor each student as much as possible, observing his/her
resolutions
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
38Slide39
Recommendations for teachers
Teachers should
use a set of strategies to facilitate student
learning
First, teachers should demonstrate how to solve problemsNext, they should give small problems for students to analyse
L
ater on, they should give
small and completely structured programs for students to completeFinally, students should make full programs from scratch
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
39Slide40
Recommendations for teachers
Teachers should
use a set of strategies to facilitate student
learning
Implement strategies to help students with their organizationDemonstrate good and wrong programming practices
Encourage
students to participate as much as possible to expose their doubts
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
40Slide41
Recommendations for students
Students should
use a set of strategies to facilitate
their learning, besides the ones already
mentionedGeneric organization strategies for their study in order to
maximize their
time to practice programming
Specific programming strategiesMemorize syntax rulesInsert comments in their programsName
things adequately Have a practical and intensive study
Solve each exercise in its fullness,
reflecting on their resolution and
adding other hypotheses/possibilities
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
41Slide42
Recommendations for students
Students should
use a set of strategies to facilitate
their learningPay attention to the error/warning messages
Make a list of the most frequent committed errors and recommendations not to forget them and frequently revise
them
or at least when errors
occurThe problem solving and algorithmic strategies are the ones in which students have more difficulties, the most difficult to learn and time consuming activities Should be intensively practised
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
42Slide43
Conclusions
There are high failure rates in the first programming subject
Many efforts have been made to support programming learning activities (
But, the results are far from having a minimum desirable success level)
In this work the
type
of errors committed by students in an introductory programming course
were analysedAnabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
43Slide44
Conclusions
Even
though students make significant syntactic and semantic errors, it was verified that the ones most difficult to surpass were logical
errors
W
e
consider the combination of hard
working students and teachers interested in this pedagogical problem are the key to having successful results.
We gave suggestions
in
order to overpass the main identified
difficulties
Anabela Gomes and Fernanda Brito Correia - Polytechnic Institute of Coimbra
44
anabela@isec.ptSlide45
ERRORS TO AVOID IN PROGRAMMING TEACHING AND LEARNING
Fernanda Brito
Correia and Anabela Gomes
Polytechnic
Institute of Coimbra
fernanda@
isec.pt ; anabela@isec.pt