From Robots to Gorillas - Department of Electrical & Computer

advertisement
Dileepan Joseph, D.Phil. (Oxon), P.Eng. (AB)
Associate Professor of Engineering
University of Alberta
FROM ROBOTS TO GORILLAS:
COMPUTER PROGRAMMING FOR
ENGINEERS
Outline
 Introduction
 Procedural C++ with Robots
 MATLAB with Gorillas
 Evaluation and Reflection
 Conclusion
ASEE Annual Conference & Exposition
June 26, 2013
2
Introduction
 ENCMP 100 Computer Programming for
Engineers is a 1-semester 3-credit-hour
course in a common 1st year program.
 The course is taught by 5 lecture instructors, 1
lab instructor, and about 20 TAs and markers
to about 800 engineering students per year.
 From 2009 to 2012, the course underwent
major changes due to student dissatisfaction,
as expressed in prior 4th year exit surveys.
ASEE Annual Conference & Exposition
June 26, 2013
3
Introduction
 The paper describes strategies taken in this
complex scenario to improve the course
material taught to students and to improve
the author’s teaching evaluations.
 Focusing on the author’s contributions, the
paper compares 2 versions of the course:
 The first, in 2008–10, taught procedural C++ (C
and C++ I/O) with a virtual robot called Karel;
 The second, since 2010, taught MATLAB with a
video game based on Gorillas, a 1991 classic.
ASEE Annual Conference & Exposition
June 26, 2013
4
Introduction
 As with recent literature, this work supports
the teaching of introductory computer
programming with MATLAB, not C/C++.
 It also provides a detailed account of how the
teaching of programming is facilitated by the
development of a complex video game.
 Moreover, the Gorillas in MATLAB approach
is distinguished by the introduction of
iterative and incremental development (IID)
to a 1st year programming course.
ASEE Annual Conference & Exposition
June 26, 2013
5
Procedural C++ with Robots
 Karel, introduced by Pattis (1981), is a virtual
robot with a simple programming language.
It was created for educational purposes.
 Bergin et al.’s update of Karel (1997), called
Karel++, was used in ENCMP 100 for 2 years.
Object-oriented aspects were hidden.
 Karel continues to be used in introductory
programming courses elsewhere, such as in
CS106A at Stanford University.
ASEE Annual Conference & Exposition
June 26, 2013
6
Procedural C++ with Robots
 Initial (left) and final (right) situations (what the
world looks like) for a Karel task (what the robot
should do), from an ENCMP 100 assignment.
ASEE Annual Conference & Exposition
June 26, 2013
7
Procedural C++ with Robots
 In addition to lecturing and examining duties,
the author developed and led a formal Karel
programming contest, based on an informal
one that was previously developed.
 Its goals were to encourage creativity and
offer personal interaction in what was a very
structured course with large classes.
 The contest, not for credit but for prizes, had
“limited” and “unlimited” categories.
ASEE Annual Conference & Exposition
June 26, 2013
8
Procedural C++ with Robots
 About 3% of the class,
or 20 students per year
(Winter Term), took
part in the contest.
 Presentations were
shared with the whole
class afterwards.
 41% of all entries and
59% of “unlimited”
entries were games.
Matti Lund and Greg Gislason present their
winning entry in the “unlimited” category
(2010). They went on to study Mechanical
and Civil Engineering, respectively.
ASEE Annual Conference & Exposition
June 26, 2013
9
Procedural C++ with Robots
 Although department-led initiatives, begun in
2009, were improving the course, faculty-led
initiatives would ultimately trump them.
 While there was consensus that “a common
core level of programming instruction be
present in our programs”, there was a lack of
consensus over the procedural C++ choice.
 After substantial internal debate and external
consultation, the faculty chose MATLAB.
ASEE Annual Conference & Exposition
June 26, 2013
10
MATLAB with Gorillas
 In developing the MATLAB course, instructors
decided to retire rather than adapt Karel.
 MATLAB enabled visual examples easily
enough, and the language was simpler.
 Another reason was to avoid duplication,
where concepts taught with one language
were then re-taught with another.
 This left a 2–3 week gap in the 12-week
course for each instructor to fill.
ASEE Annual Conference & Exposition
June 26, 2013
11
MATLAB with Gorillas
 The author taught
students to program a
game, entitled Gorillas
in MATLAB, using IID
with 6 versions.
 Each time a syllabus
part was completed,
the game was revisited
and improved based on
what was taught.
The IID model puts requirements
specification, implementation (coding),
and verification (testing) in a circular
loop. Each cycle of the loop results in a
usable prototype, which evolves.
ASEE Annual Conference & Exposition
June 26, 2013
12
MATLAB with Gorillas
 In this artillery game, which requires angle
and velocity inputs each turn, 2 gorillas throw
bananas at each other atop a city skyline.
 External resources, e.g., Nintendo images
found online, are used with attribution.
 In addition to code, which is re-developed in
class, 30 slides were prepared to frame each
version (3–4 slides) and the whole project.
 The covered syllabus correlates very well with
material in a popular textbook by Attaway.
ASEE Annual Conference & Exposition
June 26, 2013
13
MATLAB with Gorillas
Kong (facing east):
Angle (degrees)? 53
Velocity (m/s)? 11
Prof (facing west):
Angle (degrees)? 57
Velocity (m/s)? 11
Prof wins (facing west).
 Command (left) and figure (right) windows for
one game of Gorillas in MATLAB (V6). Kong and
Prof, the “final boss”, are computer players.
ASEE Annual Conference & Exposition
June 26, 2013
14
MATLAB with Gorillas
Version
MATLAB (R2012)
Attaway 2/E
1. Basics and Plotting
ALGEBRAIC AND COLON OPERATORS
1.1–1.6, 5.2,
axis, ceil, clc, clear, close, cosd, disp, figure, 2.1–2.5
hold, input, length, plot, rand, round, sind,
size, stairs, text, title, xlabel, ylabel
2. Selection and
Repetition
LOGICAL AND RELATIONAL OPERATORS
abs, break, case, clf, elseif, end, false, find,
for, if, pause, switch, true, while
3.1, 5.4, 3.2–
3.7, 4.1–4.3,
5.1, 5.5–5.6
3. Functions and
Structures
DOT OPERATOR
else, floor, function, isequal, menu,
num2str, otherwise, struct
2.7, 5.3, 6.1–
6.5, 8.2
4. Files, Strings, and Cells cell, fclose, feof, fgetl, fopen, fprintf,
isempty, strcmp, strtok, strtrim, urlread
2.6, 7.1–7.4,
8.1, 9.1–9.3
5. Images and Sounds
audioplayer, global, image, imread, load,
play, playblocking, save, subplot
14.1–14.2
6. Software Engineering
erfinv, randn, sqrt, tand
ASEE Annual Conference & Exposition
June 26, 2013
15
Evaluation and Reflection
 The author’s instructor excellence rating rose
from 50th to 75th percentile, comparable to his
other courses, by going from procedural C++
with robots to MATLAB with Gorillas.
 The impact on 4th year exit surveys will begin
to be known in 2014. Nevertheless, student
representatives no longer complain to the
ECE Department Chair about the course.
 Antagonism to the course on its 1st day has
declined from 20% (2010) to 15% (2012).
ASEE Annual Conference & Exposition
June 26, 2013
16
Evaluation and Reflection
 In 2010–11, Gorillas in MATLAB was taught
only in the author’s ENCMP 100 section, while
it was being developed for the first time.
 Peer assessment was very positive. Other
instructors decided to adopt the material,
after seeing it, for their own sections.
 Once further development was complete,
Gorillas in MATLAB was taught to 768
students in 2012 (Winter Term).
ASEE Annual Conference & Exposition
June 26, 2013
17
Evaluation and Reflection
 Gorillas in MATLAB unified the syllabus much
better than did Karel, who was barely seen in
class after the first 2 weeks, with procedural
C++ (the contest was held out of class).
 With the new course, important software
engineering concepts, like refactoring and
IID, are introduced with programming.
 All students, and not just those who enter a
contest, are taught how to develop a larger
program over a longer period of time.
ASEE Annual Conference & Exposition
June 26, 2013
18
Conclusion
 Source code, data files, and PowerPoint slides
for Gorillas in MATLAB (6 lectures) may be
downloaded from the author’s website.
 Comprising up to 25% of a 12-week course at
the University of Alberta, it is used to teach
introductory computer programming.
 The syllabus is divided into 6 parts. At the end
of each part, a version of Gorillas in MATLAB
is taught. This unifies the course nicely.
ASEE Annual Conference & Exposition
June 26, 2013
19
Conclusion
 Unlike the state of the art, the proposed
approach exploits iterative and incremental
development and video game design to teach
introductory computer programming.
 Relative to a previous course on procedural
C++ with virtual robots, students expressed
their preference for the current course by
giving the author a significantly higher
instructor excellence rating.
ASEE Annual Conference & Exposition
June 26, 2013
20
Acknowledgements
 ENCMP 100 is taught
by a team and so the
author is grateful to his
colleagues, as well as
to administrators and
students, for their roles
in course evolution.
 The author also thanks
MathWorks for their
offer of sponsorship.
Left to right: Marek Reformat, Qing Zhao,
Sarah McEvoy, Dileepan Joseph, and
Bruce Cockburn. Missing: Paul Iglinski,
Lukasz Kurgan, and others.
ASEE Annual Conference & Exposition
June 26, 2013
21
Download