Can Direct Manipulation Lower The Barriers To Computer Programming And .

Transcription

Can Direct Manipulation Lower the Barriers toComputer Programming and Promote Transfer ofTraining? An Experimental StudyCHRISTOPHER D. HUNDHAUSEN, SEAN F. FARLEY, AND JONATHAN L.BROWNVisualization and End User Programming LabSchool of Electrical Engineering and Computer ScienceWashington State UniversityNovices face many barriers when learning to program a computer, including the need to learn both a new syntaxand a model of computation. By constraining syntax and providing concrete visual representations on which tooperate, direct manipulation programming environments can potentially lower these barriers. However, what ifthe ultimate learning goal of the novice is to be able to program in conventional textual languages, as is the casefor introductory computer science students? Can direct manipulation programming environments lower theinitial barriers to programming, and, at the same time, facilitate positive transfer to textual programming? Toaddress this question, we designed a new direct manipulation programming interface for novices, and conductedan experimental study to compare the programming processes and outcomes promoted by the directmanipulation interface against those promoted by a textual programming interface. We found that the directmanipulation interface promoted significantly better initial programming outcomes, positive transfer to thetextual interface, and significant differences in programming processes. Our results show that directmanipulation interfaces can provide novices with a “way in” to traditional textual programming.Categories and Subject Descriptors: D.1.7 [Programming Techniques]: Visual Programming; H5.2[Information Interfaces and Presentation]: User Interfaces - Interaction styles; Theory and methods; K.3.2[Computing Milieux]: Computers and Education – Computer and Information Science EducationGeneral Terms: Design, Experimentation, Human Factors, LanguagesAdditional Key Words and Phrases: direct manipulation, programming education, transfer of training, semanticcomponents analysis, video analysis1. INTRODUCTIONLearning computer programming is a challenging task for many people. Whilespecialized end-user programming languages and environments are empoweringincreasing numbers of computer users to engage in programming tasks [Scaffidi et al.2005], computer science students, who aim to become professional programmers,continue to struggle with programming, as evidenced by 30 to 40 percent attrition ratescommonly observed in early programming courses [Beaugouef and Mason 2005]. A keyquestion arises: Why do so many novices not succeed as computer programmers?This research was supported by the National Science Foundation under grant nos. 0406485 and 0530708.Authors' address: School of Electrical Engineering and Computer Science, Washington State University,Pullman, WA 99163-2752. Permission to make digital/hard copy of part of this work for personal or classroomuse is granted without fee provided that the copies are not made or distributed for profit or commercialadvantage, the copyright notice, the title of the publication, and its date of appear, and notice is given thatcopying is by permission of the ACM, Inc. To copy otherwise, to republish, to post on servers, or to redistributeto lists, requires prior specific permission and/or a fee. 2008 ACM 1073-0516/01/0300-0034 5.001

Past research suggests a multitude of factors that may contribute to the high attritionrates observed in programming courses, including (a) individual student differences (e.g.,[Bergin et al. 2005]), (b) a lack of a sense of community (e,g.,[Besana and Dettori 2004]),(c) inadequate pedagogical approaches (e.g., [Guzdial 2004]), and (d) inadequate noviceprogramming environments (e.g., [Dann et al. 2000]). We focus here on factor (d): thepossibility that the human-computer interface to novice programming environments isdeficient. An extensive line of research, comprehensively reviewed in [Guzdial 2004] and[Kelleher and Pausch 2005], has attempted to lower the barriers to programming througha variety of programming interface features, including visual representations of executingcode (e.g., [Ben-Bassat Levy et al. 2003]), drag-and-drop editing (e.g., [Birnbaum andGoldman 2005]), programming by direct manipulation and gestures (e.g., [Smith et al.1994]), and support for the declarative constructs that novices appear to useindependently of programming environments [Pane et al. 2002].In conjunction with our development of an alternative “studio-based” pedagogicalapproach to teaching novices how to program [Hundhausen and Brown 2008], we havecontributed to the above line of research through the development of a noviceprogramming environment called ALVIS LIVE! [Hundhausen and Brown 2005], whichsupports both (a) up-to-the-keystroke syntactic and visual semantic feedback (a so-called“live” editing model), and (b) an interface for generating object creation statements bydirect manipulation—that is, by using a set of tools to directly lay out and modify visualrepresentations of program variables and data structures in an animation window.While a recent experimental study of the ALVIS LIVE! environment [Hundhausenand Brown 2007] showed that its “live” editing model enables novices to programsignificantly more accurately than they could without any programming environment atall, we observed that study participants still struggled to develop correct programs. Inparticular, in their attempts to write array iterative algorithms, many participants hadtrouble constructing correct loops, and referencing array elements correctly within thoseloops through the use of array indices. Consistent with past research [Soloway et al.1983], we found that iterative constructs proved to be a key stumbling block forparticipants in our study.Given that study participants appeared to benefit from ALVIS LIVE!’s directmanipulation interface for creating program objects, we posited that a direct manipulationinterface may also address the programming difficulties we observed in our study, as well2

as facilitate a smooth transition to textual programming. This led to the following threeresearch questions:RQ1: Can a direct manipulation interface for programming iterative,conditionals, and assignment statements in ALVIS LIVE! facilitate (a)faster and more accurate programming, and (b) positive transfer to textualprogramming?RQ2: How might the programming processes promoted by such a directmanipulation interface differ from those promoted by a conventionaltextual programming interface?RQ3: What might the design of such a direct manipulation interface look like?In this article, we address these questions by presenting the design of a new directmanipulation programming interface for the ALVIS LIVE! software, along with anexperimental evaluation and post-hoc video analysis that evaluate how the new interfacecompares to a traditional textual interface. The new ALVIS LIVE! interface enables oneto write iterative, conditional, assignment, and arithmetic operations through acombination of filling in dialog boxes and directly manipulating objects in ALVISLIVE!’s animation window. This new interface makes it possible for users to specify,without having to type in any textual code, the kinds of single procedure, array iterativealgorithms that students typically explore in the first weeks of an introductory computerprogramming course.Given that users of novice programming environments must ultimately migrate toconventional textual programming environments, a key objective of the directmanipulation interface explored here is to facilitate positive transfer-of-training to textualprogramming. Our concern for the issue of transfer separates the research presented herefrom past efforts to develop direct manipulation environments for the sole purpose ofeasing the programming task. As we shall see, in an experimental study, our new directmanipulation interface promoted (a) significantly faster and more accurate initialprogramming than the text-based ALVIS LIVE! interface, (b) positive transfer to textualprogramming, and (c) programming processes that differed markedly from thosepromoted by a textual programming interface.The remainder of this article is organized as follows. After reviewing related work inSection 2, we describe our new direct manipulation interface in Section 3. Section 4presents the design and results of our experimental study, while Section 5 presents a3

detailed post-hoc video analysis of our study participants’ programming processes.Finally, Section 6 outlines directions for future research.2. RELATED WORKThe research presented here develops and experimentally evaluates the effectivenessand transferability of a new direct manipulation programming interface for novices.Below, we situate our research within the context of four lines of related work.2.1 Direct Manipulation and Demonstrational Programming InterfacesA large body of work, some of which is surveyed in [Cypher 1993], shares ourinterest in transforming traditionally text-based programming tasks into tasks that can beperformed by direct manipulation and demonstration. For example, Burnett and Gottfried[Burnett and Gottfried 1998] describe an extension to the Forms/3 spreadsheetenvironment that allows users to program graphical objects by direct manipulation, ratherthan by specifying formulas. Likewise, Stasko [1991] presents an environment in whichprogrammers can specify algorithm animations by direct manipulation, rather than bywriting complex C code.To make programming more accessible to children who are first learning to program,numerous novice programming environments have explored direct manipulation anddemonstrational techniques. For example, in Lego Mindstorms [LegoSystemsInc. 1998],children can program robots by dragging iconic representations of commands from apalette onto a workspace, where they can be wired together to create a program. InStagecast Creator [Smith, Cypher and Spohrer 1994], children specify simulations bydemonstrating graphical rewrite rules in a grid-based world. In Tinker [Lieberman 1993],novices specify examples through a combination of textual programming and directmanipulation of objects; with the user’s assistance, Tinker attempts to generalize theexamples into Lisp procedures.2.2 Novice Programming EnvironmentsMore closely related to the direct manipulation programming interface explored hereis a family of novice programming environments used for teaching the imperativeprogramming paradigm commonly explored in undergraduate computer science courses.Like ALVIS LIVE!, many of these environments generate visual representations ofprogram execution (e.g., [Ben-Bassat Levy, Ben-Ari and Uronen 2003; Dann, Cooper4

and Pausch 2000]). In addition, some of these environments enable the learner to specifya program at least partly by direct manipulation. For example, ALICE [Dann, Cooper andPausch 2000] and JPie [Birnbaum and Goldman 2005] provide drag-and-drop codeeditors that prevent syntax errors. In RAPTOR [Carlisle et al. 2005], the user writesalgorithms by laying out a flowchart by direct manipulation; however, the commandswithin each element of the flowchart (e.g., conditional and assignment statements) muststill be specified textually.2.3 Experimental Evaluations of Direct Manipulation Programming InterfacesWhile numerous direct manipulation and demonstrational programming interfaceshave been developed, few have been subjected to experimental evaluation in order todetermine whether they actually ease the programming task. In one of the few suchevaluations, Burnett and Gottfried [1998] compared the speed and accuracy with whichusers could construct graphics using (a) direct manipulation and (b) textual formulaswithin the Forms/3 spreadsheet environment. Their results indicated that users couldperform programming tasks significantly faster and more accurately with the directmanipulation interface.In another study, Mudugno et al. [1997] compared the accuracy with which userscould create (by demonstration) and comprehend desktop file manipulation programswritten in a comic strip-based and text-based representational language. Participants wereable to construct significantly more accurate programs using the comic strip-basedlanguage, and to better comprehend the comic strip-based programs they generated.The experimental comparison presented here differs from these two evaluations intwo key respects. First, our study includes a detailed post-hoc analysis of participants’programming processes, providing further insight into the impact of direct manipulationinterfaces for computer programming. Second, and more important, our study considersnot only programming performance, but also the extent to which programming in a directmanipulation interface facilitates positive transfer-of-training to the kind of textualprogramming interface that computer science students must ultimately use.2.4 Studies of Programming Skill TransferWhile no prior empirical studies have specifically considered the issue of whetherdirect manipulation programming environments facilitate transfer-of-training to textualprogramming environments, there has been significant interest in the issue of transfer as5

it relates to computer programming. One line of work in this vein used computerprogramming tasks as a basis for developing theories of cognitive skill transfer (e.g.,[Pirolli and Recker 1994; Singley and Anderson 1989]). Another line of work,comprehensively reviewed by Palumbo [1990], considered the transferability ofprogramming skill to general problem solving skill.More closely related to the work presented here is a line of studies that explored thetransferability of skills gained in one programming language or environment to anotherprogramming language or environment. For example, Scholtz and Wiedenbeck [1993;1990] looked at whether skills gained with the Pascal programming language mighttransfer to Ada and Icon.They hypothesized that incongruities in the structure ofprogramming plans [Soloway et al. 1984]—sets of programming actions that achieve adesired goal—would hinder transfer. Several of their predictions based upon thishypothesis were substantiated empirically. They also found that study participants heldfragile knowledge [Perkins and Martin 1986] of their “native” language (Pascal) thathampered transfer to the other two languages.In a similar vein, in a semester-long field study within a computing course, Guzdialet al. [1998] considered the transferability of skills gained in a novice programmingenvironment (GPCEditor) to a commercial programming environment (THINK Pascal).Four of the fourteen participants voluntarily switched to THINK Pascal for later courseassignments. Guzdial et al. found that the programs that these participants produced inTHINK Pascal maintained the same level of quality as the programs that participants hadproduced previously in GPCEditor, and that the participants preferred THINK Pascal’sspeed and less constraining environment.3. NEW DIRECT MANIPULATION PROGRAMMING INTERFACEWe developed the new direct manipulation interface to ALVIS LIVE! (henceforth “thenew DM interface”) through an iterative, user-centered design process (see, e.g.,[Norman and Draper 1986]) . Using the original ALVIS LIVE! as a starting point, we firstconstructed a preliminary low fidelity prototype of the new DM interface. The prototypeconsisted of a series of static screens that were created by doctoring screenshots of theoriginal ALVIS LIVE! environment. To test and refine the interface, we ran a “wizard ofoz” prototype study, for which we recruited 15 volunteers out of the fall, 2005 offering ofthe introductory computer science course at Washington State University. The designgradually evolved into its final form through five design iterations, each of which6

consisted of input from three to five participants. For a detailed account of the user-centerdesign process that led to our final design, see [Farley 2006].Figure 1 presents an annotated screenshot of the new DM interface, which is identicalto the original ALVIS LIVE! interface [Hundhausen and Brown 2007], except that itcontains four new programming tools—“If,” “Iterate Loop,” “Set,” and “Math” (seebottom of Toolbox in Figure 1). Just as in the original ALVIS LIVE!, users of the newDM interface program in a compact pseudocode-like language called SALSA. They cando so either by typing SALSA commands directly into the Script Window, or by usingthe Toolbox Tools to specify commands by placing and directly manipulating objects inthe Animation Window. Through such direct manipulation, SALSA code is dynamicallyinserted into the Script Window on the left.As in the original ALVIS LIVE!, the focal point of the new DM interface is the greenExecution Arrow (see Figure 1), which marks the line of code that was most recentlyexecuted, and that is currently being edited. On every keystroke or direct manipulationaction, that line of code is re-executed, and the graphics in the Animation Window aredynamically updated to reflect that execution.3.1 Sample Programming SessionTo illustrate how the new DM interface works, we now step through a sample session inwhich we use the new interface to code one of the three experimental study tasks—the“Find Max” algorithm, which identifies the largest value in an array. The completeSALSA implementation of the algorithm is depicted in Figure 1.To code this algorithm, we must first create the algorithm objects. We need an arraynamed a1, a variable named maxSoFar, and an array index named i1. Each of these canbe created using the DM tools. For example, we can create the variable by clicking onthe Create Variable tool to activate it, and then clicking in the Animation Window. Avariable will appear at the cursor’s location. We can create the array in a similar fashion,using the Create Array tool. To create the array index, the same process is followed, buthere we click on the array cell where we want the index to be positioned (the left-mostcell). We can modify object attributes, such as name or array size, by right clicking onthe object, which provides us with a properties window. As each object is created,corresponding SALSA code appears in the Script Window.7

Execution ControlsToolbox ToolsExecution ArrowScriptWindowAnimationWindowNew DM ToolsFigure 1. Annotated Snapshot of the New Direct Manipulation Interface to ALVIS LIVE!Next, we need to populate the array with numbers. To do this, we first click on thePopulate tool, and then click on the array, and we see the array fill with integer values(Figure 2a).Having created all of the necessary program objects we are now in a position to makeuse of the new direct manipulation tools to flesh out the algorithm. We first need toconstruct a loop to iterate through the array. To do this, we select the Iterate Loop tool,position the cursor on the i1 index, press the mouse down, and drag the i1 index to thelast array cell. When we release the button, a while loop skeleton appears in the ScriptWindow consisting of a while statement, an index increment statement, and anendwhile statement (Figure 2b). A blank line is also created, and the caret is placedhere to indicate that the next line of code will be placed here (unless we move the caretby clicking elsewhere in the Script Window).8

(a) Populating the array with values by direct manipulation(b) Creating a while loop by direct manipulation(c) Selecting left-hand side of ifstatement(d) Selecting a conditional operator(e) Selecting right-hand side ofif statement(f) Generation of if statement in Script Window(g) Setting maxSoFar to a1[i1]Figure 2. Snapshots from a Sample Session with the New ALVIS Live! Direct Manipulation InterfaceIn order to compare the array values to maxSoFar, we now need an if statement. Wefirst click on the If tool, and then click on the first cell of the array. An array component9

selection window appears with several possible interpretations of this gesture (Figure 2c);we recognize a1[i1] as the correct left-hand side of our if statement, and click on it.Next, we are prompted to select a conditional from the if conditional menu (Figure2d), and we select “ .” The final window asks us to decide if the right-hand side of theif statement should be a variable or a number (Figure 2e). Choosing “variable,” we usethe mouse to click on maxSoFar; our completed if statement appears in the text window(Figure 2f). As with the while loop, if and endif lines appear, with a blank line inbetween, on which the editing caret is now positioned.Finally, we use the Set tool to generate a statement that assigns the current array valueto maxSoFar if the conditional test is true. We first select the Set tool, and then click onmaxSoFar—the variable to be set. We are asked if we want to set maxSoFar to avariable or a number. We select “variable,” and use the mouse to click on an array cell.As before, we are presented with a window that gives several possible interpretations ofour gesture. We choose the most general of these—a1[i1]—to complete our algorithm(Figure 2g). As with the original ALVIS LIVE!, we can now explore the algorithmfurther by using the Execution Controls to step through our code forwards andbackwards. As we do so, the execution arrow advances, and the Animation Window isdynamically updated to reflect the execution results. We can also execute to any point inthe script simply by clicking on that line with the mouse.4. EXPERIMENTAL EVALUATIONTo evaluate the new DM interface, we conducted an experimental study with two mainhypotheses:H1: Participants who use the new ALVIS LIVE! DM interface will be able tocreate algorithmic solutions significantly more quickly and accurately thanstudents who use a text-only version of ALVIS LIVE! in which code must betyped in manually.H2: Participants who use the new ALVIS LIVE! DM interface will benefit from acomplete transfer-of-training effect that will enable them to program in thetext-only version of ALVIS LIVE! with no loss of speed or accuracy, ascompared with their performance with the new DM interface.To test these hypotheses, we conducted a between-subjects experimental study withtwo conditions defined by programming interface: Text and Direct Manipulation (DM).In the Text condition, participants used a text-only version of ALVIS LIVE! for all three10

experimental tasks. In this software version, the only way to program was by enteringtextual SALSA code via the keyboard (the DM tools were disabled). In contrast, in theDM condition, for the first two experimental tasks, participants used a version of ALVISLIVE! with the new DM interface presented in the previous section, but without theability to type in textual commands (text entry into the Script Window was turned off).Hence, participants in the DM condition had to use the DM tools to program theirsolutions to the first two tasks. For the third experimental task, participants in the DMcondition switched to the text-only version of the software, thus enabling us to consider atransfer-of-training effect.Programming outcomes were assessed according to two dependent measures—semantic accuracy and time on task—that we will explain further in Section 4.4. Inaddition, to ensure that participants in each condition were equally matched with respectto general programming knowledge, we administered a multiple-choice pretest. A followup posttest, isomorphic to the pretest, was used to gauge any gains in programmingknowledge; however, our analysis of the pre-test and post-test scores failed to yield anysignificant differences (we speculate that the study duration was not long enough forprogramming knowledge differences to develop), and we will not consider it further here.4.1 ParticipantsWe recruited 34 students (29 male, 5 female; mean age 19.7) out of the spring, 2006offering of CptS 121, the introductory computer science course at Washington StateUniversity. Participants were recruited in the second week of the semester, before theyhad received formal instruction on programming. Participants received course credit fortheir participation.4.2 Materials and TasksAll participants worked on Pentium IV computers running the Windows XP operatingsystem. Equipped with mice and keyboards, the computers had 1 GB of RAM and eithera 15 or 18 inch LCD color display set to a resolution of 1024 768.Prior to working on the programming tasks, participants in both conditions completedan informationally-equivalent tutorial that introduced them to the software version theywould be using. The Text version of the tutorial introduced participants to each SALSAcommand. Participants were given a sample of each command type, and asked to typeeach command into the Script Editor, as well as to use the Execution Tools to execute11

their code. The DM version of the tutorial was identical, except that, instead of typing incommands, participants were shown how to generate commands using the DM Tools.Participants in both conditions completed three isomorphic programming tasks: FindMax, Replace, and Count. In Find Max, participants were required to construct analgorithm to locate and identify the largest value in an array. In Replace, participantswere required to construct an algorithm to find and replace array values smaller than 25.In Count, participants had to write an algorithm to count the number of array valueslarger than 50. These tasks were designed so that their solutions were semanticallyisomorphic to each other. This allowed us to employ a universal grading system,regardless of task.In the DM condition, participants used the DM version of ALVIS LIVE! (see Section3) for the first two tasks, and the text-only version of ALVIS LIVE! (identical to the DMversion, except that all of the DM Tools were removed) for the third task. In contrast,participants in the Text condition used the text-only version of ALVIS LIVE! for all threetasks.We used Morae Recorder [Techsmith Corp. 2007] to make lossless recordings ofparticipants’ screens as they worked on tasks. These recordings allowed us to recreateparticipants’ work if needed and to gauge their time on task. They also and served as abasis for the detailed post-hoc video analysis presented in Section 5.4.3 ProcedureWe used a background questionnaire to screen potential participants for priorprogramming experience; students who self-reported any prior programming experiencewere excluded from the study. The remaining students were randomly assigned to the twoconditions. In order to guard against task order effects, we fully counterbalanced theorder in which participants completed tasks within each condition. This meant thatroughly six study participants (three per condition) performed each of six possible taskorderings.The experiment was conducted during three two-hour- and-50-minute sessions, eachwith 10 to 12 participants. In each study session, participants first completed a 20-minutepre-test of conceptual programming knowledge. They then worked through a 15-minutetutorial specific to the software version they would initially use. Following the tutorial,participants were asked to start their screen recording and to begin their first task.Participants were instructed to complete each task as quickly as possible, without12

sacrificing accuracy, with the stipulation that each of the three tasks had to be completedin less than 35 minutes. After 35 minutes, or whenever they finished, participants wereasked to save their work, stop their screen recording, and move on to the next task. Aftercompleting the second task, DM participants were asked to complete the third task usingthe “text-only” interface; however, they were not provided with a tutorial for thatinterface. After finishing all three tasks, participants in both conditions completed a 20minute post-test of conceptual programming knowledge (isomorphic to the pre-test), andthen filled out an exit questionnaire.4.4 Measuring the Dependent VariablesTo measure time on task, we reviewed the screen recordings, noting the time at whicheach participant started the task (i.e., when ALVIS screen became visible) and stoppedthe task (i.e., when participants saved their work for the final time). To measureprogramming accuracy, we identified the key semantic elements of a correct solution toeach task. Because our three tasks were isomorphic, each task solution consisted of thesame set of eight semantic components presented in Table I.As can be seen from Table I, a semantic element mapped to a line or essentialproperty of a correct solution. A couple of comments are in order regarding thesecomponents. First, whereas the ways in which components 1 through 5 manifestedthemselves in code were identical across our three isomorphic study tasks, components 6and 7 manifested themselves slightly differently across the three tasks, even though theyidentify semantically equivalent operations. Second, while semantic component 8 mayappear unnecessary, it makes an important distinction in our grading system.Wediscovered that it was possible for a solution to get the first seven components correct,Table I. Semantic Components of Correct Code Solutions#1Semantic ComponentCreate ArrayTypical Manifestation in SALSA Code23456Populate ArrayCreate array indexArray index visits each cellLoop terminatesCorrect comparisonpopulate a1 with random ints between 1 and 1007Correct assignmentFindMax: set maxSoFar to a1[i1]Replace: set a1[i1] to 0Count: add 1 to count8Correct resultAlgorithm achieves correct overall resultcreate array a1 with 6 cellsset i1 to index 0 of a1Within while loop: add 1 to a1while i1 cells of a1 endwhileFindMax: if ai[i1] maxSoFar endifReplace: if a1[i1] 25 endifCount: if a1[i1] 50 endif13

but not obtain the correct result, due to extra lines of code with deleterious effects.Semantic Component 8 allowed us to distinguish

interfaces for computer programming. Second, and more important, our study considers not only programming performance, but also the extent to which programming in a direct manipulation interface facilitates positive transfer-of-training to the kind of textual programming interface that computer science students must ultimately use.