A Constructionist Approach to Computer Science ... - LearnTechLib

13 downloads 59540 Views 379KB Size Report
A version of Scratch for the iPhone has been developed, although it is ... One of the most advanced offshoot of Scratch is BYOB, or Build Your Own Blocks.
A Constructionist Approach to Computer Science Education Stefano Federici Department of Education and Philosophy University of Cagliari Italy [email protected]

Linda Stern Department of Computer Science and Software Engineering The University of Melbourne Australia [email protected]

Abstract: The use of traditional introductory approaches to computer science needs to be reevaluated in light of an increasingly technology-savvy cohort of students. New and powerful environments, such as Scratch from MIT and its descendents, provide an excellent base to develop novel approaches to learning computer programming based on constructionist learning theories. In this paper we describe a constructionist approach to introductory computer science that leverages on these new environments, motivating students to learn computer programming without the cognitive overhead usually associated with learning programming and computation. We then describe new tools we have developed that facilitate the extension of the constructionist approach to learning more complex concepts in computer science, bringing students to a deeper understanding of computer science concepts.

Introduction Computer science (CS) curricula in 2010 are for the most part still anchored to what computer science was twenty years ago: bits, bytes, assembly language, and imperative languages like C and Pascal. While these topics are all highly relevant to the core of computer science, there is no reason why they should still be used today to introduce students to computer science. Finding more engaging and effective ways to engage students in Computer Science from the very beginning is desirable, and with current developments in the field it is also now possible. The use of advanced computing to understand and solve complex problems has been labelled as “critical to scientific leadership, economic competitiveness, and national security" (PITAC, 2005). Computational Science education is getting a lot of attention by the US government: the President’s Information Technology Advisory Committee (PITAC, 2005), the Defense Advanced Research Projects Agency (DARPA, 2010), the Association for Computing Machinery and the Computer Science Teachers Association (ACM and CSTA, 2010) have all recommended that a large effort must be put in increasing the strength of current educational practices in computer science. Yet, at the same time, enrolments in computer science have declined world-wide over the last ten years, making it imperative to re-evaluate the curriculum, particularly of introductory computer science, where we can interest students in computer science. In fact, there is actually no longer a need to continue to introduce computational skills by using the oldfashioned path from bits to higher order languages, for example, the C programming language. Computational concepts can be taught today in a much easier and more effective way by using the newest introductory tools to computation developed by outstanding research centres such as MIT (Massachusetts Institute of Technology), the Carnegie Mellon University, the University of Kent. All these tools focus on the creative potential behind computation, motivating students by reducing the effort needed for them to achieve interesting results in a very short time. Furthermore, several interesting visualization tools have been developed in recent years to help students in understanding the more complex aspects of computer science. What is still missing is the link between the new introductory tools for computer science and the more complex topics, such as algorithms and complexity. In this paper we describe an environment for introducing students in a natural way to understanding computation and complexity, built on top of modern tools for introductory computer science education. We further extend the existing tools to more complex areas in computer science beyond the introductory. Our approach is firmly grounded in the constructionist theory of learning.

- 1352 -

Traditional Approach to Introductory Computer Science One of the major obstacles to making students appreciate Computer Science has been the very limited outputs that students are able to achieve until they have mastered a large body of detailed knowledge about a specific programming language. The very first example that every student of the C programming language would find in their books is the famous "Hello World!" program used by Kernighan and Ritchie in their "The C Programming Language" (1978): #include main() { printf("Hello, World!\n"); }

This code will simply display the greeting "Hello, World!" on the computer screen. But even understanding this minimal program requires that the students master a lot of esoteric knowledge about libraries, main functions, functions, strings, control characters, and programming language syntax before they can achieve this rather simple and not very exciting output. From the student point of view, this represents much effort for not very much reward. Today’s students are accustomed to seeing much more sophisticated output from computers, and many disengage from this kind of approach. While the Java programming language, with its many libraries, has greatly increased the ease with which the advanced programmer can achieve high level tasks, it has not made the situation better for the learning. The "Hello, World!" program written in Java is possibly even more complex than in C, involving additional knowledge about object oriented programming and classes: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }

Again, the output is not very exciting to most students. While interested students can get meaningful results once they have applied themselves to the discipline for some time, most students will have drifted away from CS before they reach this point. The Scratch equivalent of the Hello World program is simply a “say” block into which we enter the appropriate text:

There is no need for the student to know the details of any programming language to achieve this rather modest result. In this paper we will concentrate on the Scratch programming language (Resnick et al., 2009) and its extension BYOB (Harvey and Monig, 2010), as effective systems for computer science education that are based on the constructionist approach.

Modern Systems for Introductory Computer Science The disparity between what beginning computer science students are able to achieve with their limited knowledge and what they wish to achieve is not new. For more than a decade, computer science educators have been developing software tools to reduce the syntactic burden on students and to engage students by giving their efforts more power (Guzdial, 2004). Initially such learning tools focussed mostly on providing simple programming environments and limiting the problems students might have with the more complex languages. A well-known example of this kind of environment is BlueJ, an environment for learning Java (Kölling, 1999; Kölling and Rosenberg, 2002). What is new is the recent development of more sophisticated tools, with which we can start to close that gap, as well as the urgency to close that gap, as educators are faced with the increased expectations of the new generation of “digital natives”. Many of the modern systems are based on the constructionist theory of learning, a learning theory

- 1353 -

proposed by the mathematician and educator Seymour Papert (Papert and Harel, 1991). Constructionism builds on - but should not be confused with - constructivism, a theory of knowledge championed by Jean Piaget, who argued that children assimilate knowledge by juxtaposing new ideas with their experience (Piaget and Inhelder 1969). While constructivism is not itself a pedagogy, the theory has given rise to numerous pedagogical approaches that focus on the learning context and suggest ways to improving student learning by linking new knowledge to the knowledge a learner already holds. Constructionism retains the constructivist concept of learning as building knowledge structures, and adds the idea that this learning is particularly enhanced when the learner is consciously engaged in constructing a public entity, i.e. something that can be seen, heard or otherwise experienced by others. In 1967 Papert designed the Logo programming language as a way of putting the constructionist theory into practice (Papert, 1972). The intended difference between Logo and the other programming languages that were available in the late 1960’s was that young, inexperienced students could build meaningful products using Logo, products that were cleary more meaningful that simply printing out “Hello, world!” or processing numbers, as in the classical programming language introduction. Children using Logo could draw beautiful graphics by asking a "turtle" to actually go around on the drawing area while moving its pen up and down or they could play with words and sentences. In the first implementation of Logo, the turtle was a real robot, moving around on the floor, so to give the students a strong contact with the programming environment. The novice programmers were able to actually see and predict how the turtle would move in response to a given command and reason about which command or group of commands would achieve the desired goal. In Logo, students could immediately see the output from their programming without having to complete a full, syntactically correct program. Other successful tools for teaching CS today also focus on a hands-on approach, which as we shall see fits well within the constructionist theory of learning. We will briefly review the widely-used systems Alice and Greenfoot, and review the Scratch system in more detail, before describing our new extensions to Scratch. All of these systems seek to engage students by allowing them to write programs about things that are within their experience and interests and are well beyond the scope of what they can accomplish in the programming languages used in traditional introductory approaches. Alice (http://www.alice.org/) is a 3D programming environment and high-level language for teaching introductory programming that has been under continuous development at Carnegie Mellon University since 1999 (Cooper, 2010). Using 3D graphics and a drag-and-drop interface, Alice makes it easy for students to create an animation for telling a story, playing an interactive game, or creating a video to share on the web. Creating visualizations is rewarding and motivating to a wide variety of students. However, the interface of Alice is not particularly intuitive for novices. Terminology specific to computer science is used in places, e.g. loop, and sometimes it takes quite a bit of effort on the part of the student to achieve meaningful output. Another introductory learning environment, Greenfoot (http://www.greenfoot.org/) has been developed by researchers of the University of Kent and Deakin University (Kölling, 2009). Like Alice, Greenfoot has a graphical output, which can be motivating for students. Unlike Alice, the input is textual. The textual input has the drawback that there is a higher entry barrier before students can achieve meaningful outputs. On the other hand, the transition to programming in Java, the underlying language of Greenfoot, is smoother.

Scratch The Scratch system (http://scratch.mit.edu/), designed in 2007 by Mitchel Resnick, is the youngest and the most successful among the new programming environments. While initially designed for children, or for people who have no previous computer programming experience, today Scratch is used in several graduate courses. Scratch is heavily based on the constructionist theory of learning (see below), and the Scratch philosophy encourages people to share their own projects and to view and reuse projects created by other members of the Scratch community, which now numbers more than half a million people. In two years, the number of open source projects developed by the Scratch community freely available for download from the Scratch website has risen from less than 70,000 to more than 1.5 million. There is preliminary evidence indicating that introducing Scratch into an introductory computer-science subject at Harvard led to a sharp reduction in the number of students dropping or failing the subject (Malan and Leitner, 2007).

- 1354 -

Scratch: A Constructionist Programming Environment For Novice Programmers The Scratch programming language has evolved from Logo programming (Resnick et al., 2009). The programming environment of Scratch is really simple, and a non-programmer can run Scratch and start programming hardly even noticing they are actually programming. The interface of Scratch is basic, with few distractions. Only the important elements are visible: the cat sprite (object) on the stage on the right hand side [Figure 1], and a list of colored blocks (commands, variables, and devices) on the left hand side [Figure 2], and the Script area in the middle where the user builds his or her program using the blocks. When the colored blocks are dragged to the stage with the sprite, their effect is immediately seen by the learner. All the blocks are clearly visible in the left pane, organized into categories (movement, look, sound, pen, control, sensing, operators, variables), with each category identified by a different color [Figure 2]. The blocks can be snapped together by dragging and dropping them on the central grey area, the "Script" area [Figure 2].

Figure 1: An empty Scratch project

Figure 2: Snapping blocks together

Scratch is heavily based on constructionist principles: students can build programs by snapping blocks together, as they would do with toy bricks. All the elements of the Scratch environment are ready to be manipulated: sprites (Scratch' s main objects) can be created either by drawing them using the internal editor, by dropping pictures on the Scratch interface, or by taking a picture with the PC webcam; sounds and voices can be either recorded using the internal sound recording facility or by dropping sound files onto the interface; commands (blocks) can be "tested" by directly clicking on them in the block palette; several blocks of commands can coexists in the script area even if they are not used in the project; new blocks/variables/lists can be created by clicking on the self-explanatory "create" buttons that are visible among the blocks of the "Variable" category. Scratch models each "instruction" (each colored block) in a very natural wording: "move 10 steps", "change score by 1", "point towards mouse-pointer", obviating the need for the learner to know any specific syntax as all blocks are available in the block repository on the left hand side. The way in which blocks can combine together is constrained by their forms: only when a white halo appears around a free slot the dragged block can stick to the other blocks. The Scratch programming language itself, not only its user interface, is available in 50 different natural languages, among them Arabic, Mandarin, Eesti (Estonian), and Suomi (Finnish). While this feature is almost unnoticeable to English speaking people, is important in overcoming a basic difficulty that non-English speaking people have when confronted with programming, having to learn a foreign language (English) at the same time that they have to learn a completely new way, a formal way, of expressing their knowledge. All these features greatly reduce the cognitive overhead required to start producing meaningful output. Several other difficulties common to learning computer programming, such as the need to learn new formalisms, awkward syntax, and the seemingly unlimited possibilities for syntax errors have also been carefully avoided in Scratch through thougtful design. Variables are often one of the most difficult elements of programming languages for students to grasp, perhaps because they are so closely tied to the way computer memory works. Variables in Scratch are more intuitive represented as sprite properties (position and direction, size, costume, volume of the sprite' s "voice"), all available as "monitors", rounded blocks whose values can be immediately shown on the stage by clicking

- 1355 -

their checkboxes. Despite its simple interface, Scratch can be used to create a variety of interesting projects very easily. Support for high-level operations comes in the form of an embedded image editor, a webcam capture tool, a sound recorder, support for connecting projects and for adding special graphic effects (color, fisheye, brightness, ghost, etc). Even creating a full chat project, like the one available at http://www.sitibs.com/branches/moodle/ mod/forum/discuss.php?d=1499 (Federici, 2010), or a complex videogame like Donkey Kong is within the realm of possibility for the novice programmer (http://scratch.mit.edu/projects/Deweybears/20922). Another feature of Scratch that fits well within the constructionist philosophy of the importance of creating public outputs is support for publishing Scratch projects on the Scratch website. This can be accomplished just by clicking the "Share this project" button in the top left corner of the Scratch interface. Projects are then immediately usable online running inside a Java applet and can be downloaded and reused (remixed) by other Scratchers. A version of Scratch for the iPhone has been developed, although it is temporarily unavailable from iTunes due to recent changes in Apple policy. Versions for Flash (http://wiki.scratch.mit.edu/wiki/Experimental_Viewer) and for Android and Nintendo DSi devices (Slany, 2010) are under development, and a basic version of Scratch has been a implemented in Javascript (http://github.com/mitsuhiko/iskratch/). Since Scratch was developed primarily for children, it is not a full tool for a constructionist approach to learning computer science at any more sophisticated level. For example, while the treatment of variables is intuitive and instructive, the treatment of data structures is not so easily understood. However, it provides an excellent basis from which to work.

BYOB: moving Scratch to tertiary Computer Science The designers of Scratch have kept the Scratch language as simple as possible on purpose, so that learners can easily grasp computational concepts. While the simplicity serves the interests of introductory learning, there are a lot of interesting things that could be done by using the Scratch interface and are not available in the basic language. For example, in the basic language it is not possible to define new blocks, to read and write files, to have a full control on the elements of the tool. Even lists and string input have only recently been added to Scratch. Because Scratch is open source, however, the language and the tool can be extended by proficient SmallTalk programmers. One of the most advanced offshoot of Scratch is BYOB, or Build Your Own Blocks (http://byob.berkeley.edu/), developed by Jens Mönig and Brian Harvey (2010). BYOB is an attempt to extend the accessibility of Scratch to more sophisticated users, without losing the original audience. BYOB adds only 12 blocks, but they are powerful and add much new functionality. The latest version of BYOB adds procedures, recursion, and advanced data structures. With the development of BYOB, the blocks language Scratch/BYOB is more useful for CS teaching at the tertiary level. In 2010 Garcia and Harvey have piloted a subject using Scratch, “The Beauty and Joy of Computing”, at The University of California, Berkeley (http://freevideolectures.com/Course/2727/The-Beautyand-Joy-of-Computing). As blocks languages gain importance in tertiary computer science education, the demands on these languages for increased sophistication will continue to increase. It is now possible to develop libraries of Scratch blocks that are seamlessly integrated with the standard block categories, as we have done.

miniC++: a Minimal Drag-and-Drop Implementation of the C Programming Language While Scratch and BYOB provide support for programmatic thinking and give students a good start in computer programming, they do not completely prepare students for learning to program using standard languages. However by building on the extensive tools provided in the BYOB distribution, a language that provides such a transition for students can be built. In this section we describe the miniC++ drag-and-drop programming language developed by one of us (SF) to help students to learn C++ without the burden of C syntax. The prototype library is available at http://scratch.mit.edu/projects/s_federici/1463982 and is described in (Federici, 2011) and at http://www.sitibs.com/branches/moodle/mod/forum/discuss.php?d=1607. MiniC++ adds blocks for input (“Sensing” category, aqua color), such as the C++ command cin, for output (“Looks”, lavender), such as the C++ command cout, for comparison operators (“Operators”, green), such as +, /,