Studying Students' Attitudes On Using Examples of Game Source Code For Learning Programming
Studying Students' Attitudes On Using Examples of Game Source Code For Learning Programming
2, 265–277 265
© 2014 Vilnius University
DOI: http://dx.doi.org/10.15388/infedu.2014.07
Abstract. Games for learning are currently used in several disciplines for motivating students
and enhancing their learning experience. This new approach of technology-enhanced learning has
attracted researchers’ and instructors’ attention in the area of programming that is one of the most
cognitively demanding fields in Computer Science. Several educational, or else serious, games for
learning programming have been developed and the first results of their evaluation as a means of
learning are quite positive. In this paper, we propose using arcade games as a means for learning
programming. Based on this approach students first play a simple game, such as Snake or Tetris,
study its code and then extend it. In a pilot study carried out in the context of an undergraduate
programming course, students studied the source code of the well-known game Snake and ex-
tended it with new functionalities. The analysis of students’ replies in a questionnaire showed that
using arcade games as a means of learning programming concepts enhances students’ motivation
for learning programming, supports them in comprehending complex concepts and engages them
in carrying out programming activities.
Keywords: serious games, arcade games, programming, motivation.
1. Introduction
(Malliarakis et al., 2012). The main goal of the programming microworlds is to deal with
students’ learning difficulties through the usage of a physical metaphor that students are
familiar with, a simple programming language with a limited instruction set and simple
syntax, as well as exercises that rise students’ interest about programming (Brusilovsky
et al., 1997).
However, the educational or serious purpose games that were developed for teach-
ing programming in recent years incorporate more attractive scenarios and graphics in
comparison to programming microworlds and educational programming environments.
These games are divided into two main categories (Malliarakis et al., 2013): the educa-
tional games aiming to teach a specific programming unit and the holistic educational
games aiming to teach all basic programming concepts. The first assessment results
about game-based learning of programming are very encouraging (Kazimoglu et al.,
2012; Liu et al., 2011).
An alternative approach that applies some elements of game-based learning of pro-
gramming is the utilization of arcade games that were developed in the first place just
for entertainment purposes. Based on this approach, learning programming concepts
is accomplished through playing, studying and then extending the source code of such
games. Representative examples of this kind of games are Snake, Tetris and PacMan.
The lack of students’ motivation for learning programming experienced in the program-
ming courses of the Department of Technology Management that was recently merged
with the Department of Applied Informatics, led us in the decision to carry out a pilot
study using arcade games for teaching and learning programming.
The aim of the study presented in this paper is to investigate students’ attitudes on
using examples of arcade game source code for supporting the teaching and learning
of programming. More specifically, we wanted to investigate whether such examples
have a positive impact on students’ motivation to learn programming. For this purpose
we designed and applied a didactical intervention in the context of an undergraduate
programming course and collected data for analysis using a questionnaire filled in by
students. The course uses Java as a programming language and so games implemented
in this programming language were examined. However, it is obvious that the same ap-
proach of using examples of arcade game source code for learning programming can be
applied to other conventional programming languages as well. The rest of the paper is
organized as follows. Section 2 presents briefly the main characteristics of the educa-
tional games that have been developed for teaching and learning programming, as well
as the main characteristics of Java arcade games that can be used for the same purpose.
Section 3 presents the research questions and the methodology of the study, while sec-
tion 4 analyzes its results. Finally, in section 5 conclusions are drawn and proposals for
further research are presented.
Educational games
Educational games use a graphical interface and interesting scenarios similar to the ones
used in digital entertainment games in order to motivate students. Some of the edu-
Studying Students’ Attitudes on Using Examples of Game Source Code for ... 267
cational games for programming are focused on specific programming concepts. The
exercises solved in their context are usually related to completing code segments, match-
ing, and gap filling and not developing complete programs from scratch. Representative
examples of educational games that focus on teaching specific programming concepts
are Catacombs (Barnes at al., 2008), Saving Princess Sera (Barnes at al., 2008) and Prog
& Play (Muratet et al., 2011). However, there are also educational games that teach all
the basic programming concepts/structures. These games, usually, include many lev-
els, with each level presenting different programming concepts/structures. The player/
learner must show that he or she has comprehended the concepts of each level in order to
qualify to pass to the next level. Representative examples of such games are Robocode
(O’Kelly and Gibson, 2006) and M.U.P.P.E.T.S. (Phelps et al., 2003). A review of both
types of educational games for programming is provided in (Malliarakis et al., 2013).
Arcade games based on Java
In recent years the object-oriented design and software development technique has pre-
vailed, while one of the most popular object-oriented languages is Java. Thus, several 2D
games were developed using Java’s Swing package of classes for creating the underlying
graphical user interface (GUI) and the Java 2D application programming interface (API)
for drawing two-dimensional graphics. Typical examples of such games are Snake, Tet-
ris, Packman, Minesweeper, Space invaders and Sokoban. Although these games were
developed for entertainment purposes they use numerous programming concepts and
they can be used as the basis for learning programming as well.
In order to further support novice programmers, teachers have developed specially
designed classes to reduce the complexity of the aforementioned Java’s tools used for
implementing Java 2D games. An example is the effort of Professor Viera Proulx that
has developed a related set of libraries. These libraries provide the possibility of design-
ing the behavior of an interactive two-dimensional game, without requiring from the stu-
dent to get involved with details about the design of the graphical user interface, drawing
graphics and handling events (http://www.ccs.neu.edu/javalib/World/).
The student is primarily concerned with the model of the game, while the design of the
games’ screens can be composed with simple geometric shapes and images.
A recent evolution of the aforementioned two approaches was the development of
networked game engines that provide additional functionality to students. Such engines
include integrated graphics environments in order to develop games and provide the pos-
sibility to use the relevant libraries for implementing, debugging and sharing games via
internet. A typical example of an online game engine is the Fang Engine (Freely Avail-
able Networked Game Engine), which was developed with the aim of supporting under-
graduate introductory programming courses based on Java. At the website of this engine
(http://www.fangengine.org/index.php/Main_Page) relevant educa-
tional material is available, such as games code, tutorials, exercises, students’ projects,
information about courses that utilize the online game engine, as well as the source code
of games that are analyzed in the corresponding textbook (Ladd and Jenkins, 2011).
It is clear that educational games developed for learning programming and arcade
games that are used as a means of learning programming share some common charac-
teristics, but they have important differences as well. In educational games for program-
268 A. Theodoraki, S. Xinogalos
ming the goal is to motivate students to carry out programming activities and learn by
engaging them in playing a game with a scenario closely related to games played for
entertainment purposes. In arcade games students also play the game, but they do not
learn in the context of playing. Students study and extend the source code implementing
the game per se, which means that the proposed activities modify the game and are not
just carried out in the context of the game. Furthermore, students must have some expe-
rience in programming in order to use and extend such a game. Students in educational
games learn by playing, while in arcade games students learn by playing, studying and
modifying the source code of the game.
3. The Study
In this section the research questions of the study, the methodology, the data collected
and analyzed for answering these questions and information about the participants are
presented.
The study presented in this paper aimed at investigating the following questions:
●● Question 1: Is students’ interest and motivation in learning programming in-
creased by the use of arcade games?
●● Question 2: Does the use of arcade games supports students in comprehending
programming concepts and acquiring problem solving capabilities?
●● Question 3: What are students’ perceptions and expectations about using arcade
games for learning programming?
3.2. Methodology
The study presented in this paper was conducted during the academic year 2012–2013
in the Department of Technology Management at the University of Macedonia in Greece
within the elective course “Network-Centric Software”, which is taught during the
eighth semester. This course aims at familiarizing students with various aspects of the
network-centric programming language Java for developing desktop applications, ap-
plets and web applications based on servlets and Java Server Pages. The programme of
studies includes two additional programming courses in previous semesters: “Computer
Programming” based on the imperative programming language C at the second semester
and “Object-Oriented Design and Programming” based on Java at the third semester
(Xinogalos, 2012). Therefore the students who participated in the study had already had
basic knowledge of object oriented programming and the programming language Java.
A twenty-minute presentation of the Snake game was conducted during the pre-final
lecture of the semester (the 12th lecture). The presentation included a brief demonstration
of the game and an analysis of the most basic parts of its source code that included both
known and new concepts. The purpose of the presentation was to summarize some GUI
Studying Students’ Attitudes on Using Examples of Game Source Code for ... 269
programming concepts which were taught during the semester and also to give students
a realistic example in order to understand how these concepts are implemented in the
context of a game.
Students were asked to expand the aforementioned 2D game – the Snake – that is
familiar to everybody, and then answer a questionnaire. The presentation and the code
Aof twenty-minute
the A twenty-minute
original presentation
version ofpresentation
of theas
the game, of
Snake
the Snake
well game
as the was
gameconducted
exercise wasandconducted
theduring during
the pre-
questionnaire the pre-
were
th th
final lecture
final lecture
available of the
via the asynchronous
ofsemester
the semester(thelearning
12(the lecture).
12 lecture).
platform The presentation
of theThe presentation
University. included included
a briefa brief
demonstration
demonstrationof the of game the and
game anandanalysis
an analysis
of the of most thebasic
mostparts
basicofparts
its source
of its source
code code
that included
that included
both known both known and new andconcepts.
new concepts.The purposeThe purpose
of the of presentation
the presentationwas to was to
Data
3.3.summarize
summarize Collection
some GUI
someprogramming
GUI programming concepts concepts
which whichwere taught
were taught
during during
the semester
the semester
and also andtoalso giveto students
give students a realistic
a realistic
example example
in order in to
orderunderstand
to understand
how these how these
concepts concepts
are implemented
Assignment are implemented in the context
in the context
of a game. of a game.
Students Students
The project were asked
were to
assigned asked
asexpand to expand
homework the aforementioned
the aforementioned
involved expanding 2D game
and 2Dmodifying
-game
the Snake
- thetheSnake
– Snake
that is
– game
that is
familiar familiar
to everybody,
to everybody,and thenandanswer
then answer
a questionnaire.
a questionnaire.
The
(Fig. 1). In the initial version of the game the Snake has to eat as many apples as pos- presentation
The presentation
and the and
codethe code
of the original
of the original
version version
of the game,
of the as
game,
well asas well
the exercise
as the
sible, avoiding the walls and its body. The body of the Snake grows up each time an exercise
and the and
questionnaire
the questionnaire
were were
available
appleavailable
via thevia
is eaten asynchronous
the asynchronous learning learning
platform platform
(http://zetcode.com/tutorials/javagamestutorial/of the University.
of the University.
snake/). The most important extensions that students were asked to implement are the
3.3 following:
Data Dataadd
3.3Collection objects in addition to the apple which can be eaten by the Snake; calcu-
Collection
late and display the player’s score when the game is over– each object gives different
points; change the game’s background; and add buttons (play, pause, repeat) at the bot-
tomAssignment
Assignmentof the frame (Fig. 2). Furthermore, they were asked to make proposals for additional
actions/functions
The project
The project
assigned thatas could
assigned ascontribute
homework homework to involved
involved theexpanding
improvement andofmodifying
expanding the
andgame.
modifying
the Snake the Snake
game (Fig.
game 1).
Questionnaire (Fig.
In the
1). initial
In the version
initial version
of the game
of the the
game Snake
the Snake
has to has
eat as
to many
eat as apples
many apples
as possible,
as possible,
avoiding avoiding
the walls
the and
walls itsand
body.its The
body. body
The
Carrying out the homework based on the Snake game was a prerequisite for the com- of
body
the of
Snake
the Snake
grows grows
up eachup each
time an timeapple
an apple
is eaten is (http://zetcode.com/tutorials/javagamestutorial/snake/).
eaten (http://zetcode.com/tutorials/javagamestutorial/snake/). The The
pletion of the questionnaire. The questionnaire included, mainly, closed type questions
most important
most importantextensions extensions
that students
that students
were asked were to asked
implement
to implement
are theare following:
the following:
add(Likert-scale)
objects
add objects which
in addition were
in addition
to thedivided
to
apple into four
the which
apple cancategories:
which becaneatenbe by
eaten
the by
Snake;
the Snake;
calculate calculate
and and
1. Questions
displaydisplay
the player’s that
scoreexamine
the player’s when
score the whether
when game students
the isgame
over– practice
is each
over– object
each programming
object gives inside
gives different different andpoints;
points; out-
changechange
theside
game’s game’s
background;
the university background;
and andwhatadd andbuttons
means add of buttons
(play, pause,
learning (play,
they pause,
repeat)to
prefer repeat)
atuse.
the bottom
at the bottom
of of
the framethe frame
(Fig. 2).
2. Questions (Fig.Furthermore,
about 2). their
Furthermore,
they were
involvement theywith
asked
weredigital
to
asked
make to proposals
make proposals
entertainment for additional
games. for additional
actions/functions
actions/functions
that could that contribute
could contributeto the improvement
to the improvement of the game.
of the game.
3.4. Participants
Twenty-three (23) students participated in this study of which 16 (69.6%) were men
and 7 (30.4%) were women. Out of the 23 students that participated in the research
only 7 attended the lecture where the game was presented. However, the material of the
presentation of the Snake game, the project and the questionnaire were posted on the
asynchronous learning platform that is used for the course.
In this section, students’ replies in the questionnaire are analyzed giving emphasis on the
part of the questionnaire that investigates students’ perceptions on using arcade games
for learning programming. Such games are characterized in the following paragraphs as
simple games, since this is how students usually characterize such games in contrast to
more advanced 3D entertainment games.
As mentioned the questionnaire consisted mainly of closed-type, Likert-scale ques-
tions, where the possible answers were: 1 – Strongly Disagree, 2 – Disagree, 3 – Not
Sure, 4 – Agree and 5 – Strongly Agree. In Tables 1, 2 and 3 the percentage of replies
falling in each one of these 5 responses, as well as the mean value (in the scale of 1 to 5)
of students’ replies is presented.
side the university. 30.4% (7 out of 23 students) of the population practice programming
outside the university as well, with 13% (3 out of 23 students) of them spending on
programming one to two hours of their free-time per week and 8.7% (2 out of 23 stu-
dents) spending three to five hours weekly. On the other hand the majority of students
and specifically 69.6% (16 out of 23 students) do not practice programming outside the
university.
Means for learning programming
The main means for learning that are used by students in order to support and enrich
their knowledge on programming concepts taught in the context of their courses – except
textbooks – are video tutorials posted on YouTube and webpages that contain imple-
mented code examples and explanations.
Another important aim of this study was to examine at what percentage and with what
frequency students play digital entertainment games. 30.4% of the respondents play
computer games, with 26.1% of them playing daily and 47.8% more than 4 times a
week. In conclusion, one out of three students who participated in this survey is attracted
by computer games and spends part of his/her free time in playing games. This percent-
age of students playing games is smaller than expected, but we have to acknowledge that
the number of participants was also small.
Table 1
Replies regarding the motivation provided by games in learning programming
Statement
Disagree (%)
4-Agree (%)
3-Not Sure
2-Disagree
1-Strongly
5-Strongly
Agree (%)
deviation
Standard
Mean
(%)
(%)
[T1.1] Game-based projects (e.g. Snake) give me a 0 0 13 60.9 26.1 4.13 .63
lots of benefits
[T1.2] I would prefer to learn programming concepts 0 8.7 26.1 34.8 30.4 3.87 .97
through analysis of simple 2D games
[T1.3] I am interested in using simple games as a means 8.7 4.3 17.4 52.2 17.4 3.65 1.11
of learning programming concepts in the future
[T1.4] I am interested in using simple games as a me- 0 0 26.1 47.8 26.1 4.0 .74
ans of learning other subjects in the future
[T1.5] I prefer to solve programming exercises which 0 4.3 30.4 34.8 30.4 3.91 .90
are based on simple 2D games
[T1.6] The usage of computer games makes this sub- 0 0 4.3 34.8 60.9 4.57 .59
ject more interesting
[T1.7] If I was taught programming with simple ga- 0 8.7 17.4 56.5 17.4 3.83 .83
mes I would perform better in relevant courses
Table 2
Replies regarding the contribution of games at Cognitive Development
Statement
Disagree (%)
4-Agree (%)
3-Not Sure
2-Disagree
1-Strongly
5-Strongly
Agree (%)
deviation
Standard
Mean
(%)
(%)
[T2.1] Games like this help me develop critical 0 0 34.8 60.9 4.3 3.7 .56
thinking
[T2.2] Solving problems in the context of simple 0 4.3 21.7 39.1 34.8 4.04 0.88
games (e.g. Snake) is very interesting
[T2.3] It is worth to try using games for learning 0 13 4.3 39.1 43.5 4.13 1.01
new programming concepts in the future
[T2.4] Looking for answers about exercises based 0 0 26.1 39.1 34.8 4.09 .79
on games is an encouraging activity
[T2.5] This game strengthened my efforts for com- 0 13 21.7 30.4 34.8 3.87 1.06
prehending the programming concepts imp-
lemented in it
Table 3
Students’ expectations about utilization of the game-based learning approach
Statement
4-Agree (%)
3-Not Sure
2-Disagree
1-Strongly
5-Strongly
Agree (%)
deviation
Disagree
Standard
Mean
(%)
(%)
(%)
[T3.1] I would like to have more opportunities 0 4.3 4.3 60.9 30.4 4.17 .72
to learn using the game-based learning
approach
[T3.2] I prefer using games to learn compared to 0 4.3 26.1 39.1 30.4 3.96 .88
traditional methods in class
[T3.3] I would like to be taught all Informatics 0 26.1 43.5 17.4 13 3.17 .98
courses using educational games
[T3.4] I would like such kind of games to be ava- 0 0 0 69.6 30.4 4.30 .47
ilable online for easy access
274 A. Theodoraki, S. Xinogalos
spondents ([T3.2]: 69.5%) prefer using games for learning compared to traditional meth-
ods in class. On the other hand, less than one third of students ([T3.3]: 30.4%) would like
to be taught all Informatics courses using educational games, while 43.5% of them are
not yet sure. Probably this is due to the fact that students did not have any prior experi-
ence in game-based learning in other courses and it is difficult for them to understand
how games could be utilized in their context. Finally, all the respondents ([T3.4]: 69.6%
agree and 30.4% strongly agree) would like such games to be available online for easy
access. Therefore, it seems that students hold high expectations for a game-based learn-
ing of programming, but they seem to be divided about the use of game-based learning
for other Informatics courses.
Students’ comments for improving the Snake game can provide general insights
for devising games that engage and motivate students, no matter what the area of the
game is. Students consider important features for a game the following: existence of
levels; obstacles and forbidden actions for increasing difficulty; calculation of scores,
high scores and ranking of each player (competition); changes in the appearance of the
game’s actor and background; music.
Students’ preferences in arcade games
As part of the questionnaire students were asked to rank eight well-known, arcade games
from the most interesting to the least interesting on a scale from 1 to 8. The purpose of
this classification was to form a global view about students’ preferences regarding games
in order to understand which ones excite their interest for further study. Seventeen out of
the 23 students completed correctly the games’ classification. For each game the “votes”
received for each possible place (1st, 2nd, 3rd, etc.) were counted. For example, 12 from
the 17 students ranked in the first place the packman game. Thus, with the same way we
obtained the following results:
1st place: Packman
2nd place: Break Collision
3rd place: Tetris
4th place: Snake
5th place: Space Invaders
6th place: Puzzle
7th place: Sokoban
8th place: Minesweeper
So, the Snake game that was used in our study is somewhere in the middle of this
ranking. Besides that students were motivated and evaluated positively the whole ap-
proach, as analyzed in the previous sections.
5. Conclusions
In this paper a study on students’ attitudes and perceptions on the potential utilization
of arcade games for an enhanced learning of programming was presented. In order to
investigate this issue a didactical intervention on an undergraduate programming course
was designed. Specifically, the well-known Snake game was selected and educational
material consisting of a presentation of the game and a set of exercises for extending
the game and making it even more interesting, as well as a questionnaire were prepared.
This game was selected for the following reasons: (1) it implements several program-
ming concepts, especially GUI concepts that were of interest for us; and (2) it is a game
that has managed to entertain many generations. Our main goal was to transfer our stu-
dents the message that learning programming can be an entertaining activity. A twenty
minute presentation of the game was made in the context of a typical lecture and then
students had to play the game, study the relevant material, complete the game-related
assignments and answer a questionnaire.
276 A. Theodoraki, S. Xinogalos
The analysis of students’ replies in the questionnaire showed that this teaching ap-
proach has the potential to increase students’ motivation and interest in programming
significantly. Using arcade games for teaching and learning programming can provide
a much more creative and entertaining context for students. The majority of students
stated that they prefer learning programming concepts through the analysis of games
and also they prefer solving game-based programming exercises. Moreover, they believe
that if they were taught programming with games they would have performed better in
relevant courses.
Utilizing arcade games in problem solving was perceived by the majority of stu-
dents as both a very interesting and encouraging activity. Students stated that the game
strengthened their efforts towards comprehending the underlying concepts and helped
them develop critical thinking.
The majority of students prefers games for learning in comparison with typical teach-
ing methods and would like to have more opportunities for learning through games.
Students consider games ideal for learning programming and would like to use them for
learning programming concepts in the future, but they seem not to be sure if the same
could apply to all fields of informatics.
Concluding, it is clear that the results of this study were rather positive regarding
the utilization of arcade games for learning programming. However, it is also clear that
further research is required in order to validate the results. It is obvious from students’
replies that their motivation for learning programming is increased, but their impact
on acquiring problem solving skills has to be evaluated. An experimental study with
a larger number of participants, more game-based exercises and evaluation of their
impact on students’ achievements is considered necessary in order to draw more ob-
jective and reliable results. Such a study could be based on utilizing games that were
ranked in the first places in students’ preferences, such as PacMan, Break Collision and
Tetris. Moreover, the educational benefits of utilizing networked game engines should
be investigated, since students explicitly stated their preference in having such games
available online.
References
Barnes, T., Chaffin, A., Powell, E., Lipford, H. (2008). Game2Learn: improving the motivation of CS1 stu-
dents. In: Proceedings of the 3rd International conference on Game development in computer science edu-
cation. 1–5.
Brusilovsky, P., Calabrese, E., Hvorecky, J., Kouchnirenko, A., Miller P. (1997). Mini-languages: a way to learn
programming principles. International Journal of Education and Information Technologies, 2, 65–83.
Chen-Chung Liu, Yuan-Bang Cheng, Chia-Wen Huang (2011). The effect of simulation games on the learning
of computational problem solving. Computers & Education, 57(3), 1907–1918.
Ibrahim, R., Yusoff, R.C.M., Omar, H.M., Jaafar, A. (2011). Students perceptions of using educational games
to learn introductory programming. Computer and Information Science, 4(1), 205–216.
Kazimoglu, C., Kiernan, M., Bacon, L., Mackinnon, L. (2012). A serious game for developing computational
thinking and learning introductory computer programming. Procedia – Social and Behavioral Sciences,
47, 1991–1999.
Ladd, B. C., Jenkins, J. (2011). Introductory Programming with Simple Games: Using Java and the Freely
Available Networked Game Engine. John Willey & Sons.
Studying Students’ Attitudes on Using Examples of Game Source Code for ... 277
Malliarakis, C., Satratzemi, M., Xinogalos, S. (2012). Towards the constructive incorporation of serious games
within object oriented programming. In: Proceedings of the 6th European Conference on Games Based
Learning (ECGBL 2012). 301–308.
Malliarakis, C., Satratzemi, M., Xinogalos, S. (2013). Towards a new massive multiplayer online role playing
game for introductory programming. In: Proceedings of the 6th Balkan Conference in Informatics (BCI
‘13). ACM Press, 213–220.
Muratet, M., Torguet, P., Viallet, F., Jessel, J.P. (2010). Experimental feedback on Prog&Play, a serious game
for programming practice, Eurographics, 1–8.
Muratet, M., Torguet, P., Viallet, F., Jessel, J.P. (2011). Experimental feedback on Prog&Play: a serious game
for programming practice. In: Computer Graphics Forum. Blackwell Publishing Ltd, 30(1), 61–73.
O’Kelly, J., Gibson, P. (2006). RoboCode & problem-based learning: a non-prescriptive approach to teaching
programming. ACM SIGCSE Bulletin, 38(3), 217–221.
Phelps, A, Bierre, K., Parks, D. (2003). MUPPETS: multi-user programming pedagogy for enhancing tradi-
tional study. In: Proceeding of the 4th Conference on Information Technology Education, October 2003,
Lafayette, Indiana, USA. 100–105.
Xinogalos, S. (2012). Programming techniques and environments in a technology management department. In:
Proceedings of the 5th Balkan Conference in Informatics (BCI 2012). ACM Press, 136–141.