Providing a Context to Motivate NonMajors Into Computing Mark Guzdial College of Computing/GVU Georgia Institute of Technology Story Georgia Tech and the challenge of teaching programming to everyone Contextualized CS as a way of motivating the study of computer science What does contextualized CS look like? Introduction to Media Computation as an example Assessment results from three different CS1’s Where we’re going next Georgia Tech Georgia Institute of Technology 28% female overall Colleges: Computing (11% female undergrad), Engineering, Ivan Allen (Liberal Arts), Sciences, Management, Architecture Universal requirement of computing Georgia Tech requires a course in computing of every student. Consider computing a necessary prerequisite in a technological institution. Only a single course has been available: CS1321 Introduction to Computing Developed for our majors Uses Scheme with the text How to Design Programs Universal access to computing In 1961, Alan Perlis argued that computer science should be part of a liberal education. Explicitly, he argued that all students should learn to program. Consider a contrast with Calculus Calculus is about rates, and that’s important to many. Computer science is about process, which is important to everyone The best uses of technology are going to come from outside of computer science. If we want computing technologies to become useful, they have to get out of our hands. How close are we to being able to teach everyone CS? Not very: CS1 is one of the most despised courses for nonmajors At many departments, CS retention rates are lower than the rest of campus Drop-out rates in CS1 near 50% at many institutions At Georgia Tech: 65% for 1995 cohort, vs. 73% for Engineeering At Georigia Tech: 28% WFD (Withdrawl, F, or D rate) typically; but with some spikes. Female enrollment in CS has been dropping nationally Why? Several recent studies and books claim that CS instruction tends to dissuade anyone but white males “Tedious,” “taught without application relevance,” “boring,” “lacking creativity,” “asocial” The Challenge In order to motivate students to care about computing, we need to make it relevant, social, and creative Contextualized CS1 During Spring 2003, Georgia Tech offered three different CS1 courses: CS1321: Traditional CS1 (n=127, in section studied) COE1361: Computing for Engineers (n=75) Same conceptual content as CS1321 but in MATLAB and Java with data-first applications. CS1315: Introduction to Media Computation (n=121) Introduction to programming and computing concepts, using media manipulation as a context. Comparing the three courses CS1 (CS1321) COE (COE1361) MediaComp (CS1315) Learning Objectives Programming Language Majors Students as software developers Tool builders Scheme MATLAB & Java Tool modifiers Python (Jython) All, but designed for CS majors Engineering Management, Liberal arts, Architecture, Biology Assessment Led by Ph.D. student Andrea Forte With Lauren Rich (Undergrad) and Rachel Fithian (MS HCI) Surveys in all three courses: Beginning, midterm, and final survey Interviews with students in CS1 and MediaComp Demographic data Start of term survey: What is Computer Science? The audiences for these classes come in with different preconceptions. Course Don't Know How ProgramComputers ming Work Scary/ Required Difficult Class Web/ Internet CS1 4.9% 6.1% 51.2% 8.5% 7.3% 0.0% MediaComp 4.7% 7.0% 48.8% 10.5% 15.1% 8.1% COE 11.4% 18.2% 45.5% 2.3% 4.5% 0.0% Particular Focus: Introduction to Media Computation 121 students in Spring 2003, with 300 planned for Fall 03 and 450 for Spring 04 2/3 female in Spring 2003 MediaComp Focus: Learning programming and CS concepts within the context of media manipulation and creation Converting images to greyscale and negatives, splicing and reversing sounds, writing programs to generate HTML, creating movies out of Web-accessed content. Motivating the Computing As professionals, these students will often the use the computer as a communications medium. All media are going digital, and digital media are manipulated with software. Knowing how to program, then, is a communications skill. def clearRed(picture): for pixel in getPixels(picture): setRed(pixel,0) def greyscale(picture): for p in getPixels(picture): redness=getRed(p) greenness=getGreen(p) blueness=getBlue(p) luminance=(redness+blueness+greenness)/3 setColor(p, makeColor(luminance,luminance,luminance)) def negative(picture): for px in getPixels(picture): red=getRed(px) green=getGreen(px) blue=getBlue(px) negColor=makeColor(255-red,255-green,255-blue) setColor(px,negColor) Use a loop! Our first picture recipe def decreaseRed(picture): for p in getPixels(picture): value=getRed(p) setRed(p,value*0.5) original Used like this: >>> file="/Users/guzdial/mediasources/barbara.jpg" >>> picture=makePicture(file) >>> show(picture) >>> decreaseRed(picture) >>> repaint(picture) Recipe to Increase the Volume def increaseVolume(sound): for sample in getSamples(sound): value = getSample(sample) setSample(sample,value * 2) Using it: >>> f="/Users/guzdial/mediasources/gettysburg10.wav" >>> s=makeSound(f) >>> increaseVolume(s) >>> play(s) >>> writeSoundTo(s,"/Users/guzdial/mediasources/louder-g10.wav") Generalizing Algorithms We talk about algorithm complexity later in the course, after the media is done. We talk about different approaches to the same problem, where the criteria might be aesthetics or correctness, instead of speed or size For example, generating greyscale During the media, we point out similar themes in different functions. We refer to them as “sub-recipes” Scaling the picture down def copyBarbsFaceSmaller(): # Set up the source and target pictures barbf=getMediaPath("barbara.jpg") barb = makePicture(barbf) canvasf = getMediaPath("7inX95in.jpg") canvas = makePicture(canvasf) # Now, do the actual copying sourceX = 45 for targetX in range(100,100+((200-45)/2)): sourceY = 25 for targetY in range(100,100+((200-25)/2)): color = getColor(getPixel(barb,sourceX,sourceY)) setColor(getPixel(canvas,targetX,targetY), color) sourceY = sourceY + 2 sourceX = sourceX + 2 show(barb) show(canvas) return canvas Scaling the picture up def copyBarbsFaceLarger(): # Set up the source and target pictures barbf=getMediaPath("barbara.jpg") barb = makePicture(barbf) canvasf = getMediaPath("7inX95in.jpg") canvas = makePicture(canvasf) # Now, do the actual copying sourceX = 45 for targetX in range(100,100+((200-45)*2)): sourceY = 25 for targetY in range(100,100+((200-25)*2)): color = getColor(getPixel(barb,int(sourceX),int(sourceY))) setColor(getPixel(canvas,targetX,targetY), color) sourceY = sourceY + 0.5 sourceX = sourceX + 0.5 show(barb) show(canvas) return canvas Recipe for halving the frequency of a sound def half(filename): source = makeSound(filename) target = makeSound(filename) This is how a sampling synthesizer works! sourceIndex = 1 for targetIndex in range(1, getLength( target)+1): setSampleValueAt( target, targetIndex, getSampleValueAt( source, int(sourceIndex))) sourceIndex = sourceIndex + 0.5 Here are the play(target) return target pieces that do it Compare these two def copyBarbsFaceLarger(): # Set up the source and target pictures barbf=getMediaPath("barbara.jpg") barb = makePicture(barbf) def half(filename): canvasf = getMediaPath("7inX95in.jpg") source = makeSound(filename) canvas = makePicture(canvasf) target = makeSound(filename) # Now, do the actual copying sourceX = 45 for targetX in range(100,100+((200-45)*2)): sourceIndex = 1 for targetIndex in range(1, getLength( target)+1): sourceY = 25 for targetY in range(100,100+((200-25)*2)): setSampleValueAt( target, targetIndex, color = getColor( getSampleValueAt( source, getPixel(barb,int(sourceX),int(sourceY))) int(sourceIndex))) setColor(getPixel(canvas,targetX,targetY), color) sourceIndex = sourceIndex + 0.5 sourceY = sourceY + 0.5 sourceX = sourceX + 0.5 play(target) show(barb) show(canvas) return target return canvas Both of them are sampling Both of them have three parts: Setting up the objects: Source and target A loop where samples or pixels are copied from one place to another To decrease the frequency or the size, we take each sample/pixel twice In both cases, we do that by incrementing the index by 0.5 and taking the integer of the index Finishing up and returning the result Making it better: Averaging/blurring to smooth the result There are serious algorithm issues here, but it’s not sorting. Using your personal pictures And messin’ with them Relevance through Data-first Computing Real users come to a user with data that they care about, then they (unwillingly) learn the computer to manipulate their data as they need. MediaComp works the same. We use pictures of students in class demonstrations. Students do use their own pictures as starting points for manipulations. Some students reversed sounds looking for hidden messages. How often do students use their second week of CS1 on their own data? How does that change the students’ relationship to the material? They started doing this in the second week In COE course, 30% of the students reported at midterm that they had used some of the course content. Rough overview of Syllabus Defining and executing functions Pictures Psychophysics, data structures, defining functions, for loops, if conditionals Bitmap vs. vector notations Sounds Psychophysics, data structures, defining functions, for loops, if conditionals Sampled sounds vs. synthesized, MP3 vs. MIDI Text Converting between media, generating HTML, database, and networking Movies Then, Computer Science Computer science as a solution to their problems “Writing programs is hard! Are there ways to make it easier? Or at least shorter?” “Movie-manipulating programs take a long time to execute. Why?” Object-oriented programming Functional programming and recursion Algorithmic complexity “Why is PhotoShop so much faster?” Compiling vs. interpreting Machine language and how the computer works Assignments encourage learning in social contexts Homework are all collaborative Quizzes are preceded by nearly-identical, collaborative pre-quizzes Two “take-home exams” (programming assignments) are non-collaborative Assignments encourage creativity For several homeworks, the task is to manipulate media in some way, but we don’t care what media For example, creating a collage or building an animation Encouraging homework results to be posted to CoWeb (collaborative website) in galleries First Homework assignment Homework 1: Write a program named hw1 to accept a picture as input, and change its pixels as follows: • • • Set the green component to 125% of its current value Decrease the blue by 25% Decrease the red by 75% Solutions shared in the CoWeb Homework #3: Make a collage with images that you modify by code only—any images you want End of term results Of the 121 students who started, only three dropped MediaComp. When asked “What part of this class should not change?” 19% of MediaComp students mentioned the CoWeb 20% mentioned “collaboration” in some form WFD Rate CS1 42.9% COE 18.7% MediaComp 11.5% Midterm survey: “What do you like best about this class so far?” Don't like it /Nothing Enjoy Content Content is Useful Traditional CS1 18.2% 12.1% 0.0% COE 12.9% 16.1% 25.8% MediaComp 0.0% 21.3% 12.4% Midterm MediaComp Survey: “What do you like about the class?” “I like the feeling when I finally get something to work.” “Very applicable to everyday life.” ‘I dreaded CS, but ALL of the topics thus far have been applicable to my future career (& personal) plans—there isn't anything I don't like about this class!!!” Non-majors surprised to find that they like contextualized computing Interviewer: Has this class changed your opinion of computer science? MediaComp Student (female): Yes, I’m not intimidated by it anymore. My mom was so surprised when I told her I want to be a TA she almost fell on the floor, ‘cause she’s heard me complain for years about taking this class and now I want to go do it to myself again! Non-major students want to learn about computing From an interview with an Engineering student in traditional CS1: “I think if anything [should be required] it should be the second one [course], like Java. A lot of people know that Scheme isn’t used and so a lot of people want to copy the homework and get through it. They’re not very motivated. I’ve heard that Java and C and all those, they are different, and I’d like to learn C and Java and all that.” Where we’re going next This was only the pilot. We should still be skeptical. Where do these students go next? Does MediaComp influence how they use computing in their own major? Does it influence any of them to take more CS? How does it change as it goes out beyond? Spring ’04: Others teaching it at Tech. Already being trialed elsewhere (at Gainesville College) How well does Python transfer to other languages and contexts? Exploring a high school version of the course. Conclusions Our classes are driving people away from computer science. Part of the problem is that we are too abstracted away from the relevant problem domains. We are not Mathematics. These students won’t use Calculus every day, But they will use Computing. We have to teach better. Contextualized CS seems to be leading to more motivation and better performance. Hard issues here: Budgets and teaching loads—”for non-majors?!?” But it may be our greatest impact as a discipline— extending CS beyond our borders. Acknowledgements Course materials development: Jason Ergle, Claire Bailey, Ellie Harmon, Toby Ho, David Raines, Joshua Sklare, Adam Wilson, Andrea Forte, Mark Richman, Matt Wallace, Alisa Bandlow, Keith McDermott, Derek Chambless, Larry Olson, Eric Mickley, Lauren Biddle. Assessment: Andrea Forte, Rachel Fithian, Lauren Rich Thanks for support to Vice-Provost Bob McMath and the Al West Fund, to GVU and the College of Computing, and the National Science Foundation For further information Course CoWeb: http://coweb.cc.gatech.edu/cs1315 Where we planned the course: http://coweb.cc.gatech.edu/mediaComp-plan guzdial@cc.gatech.edu