Teachscheme, ReachJava: introducing object-oriented programming without drowning in syntax: poster session

This poster presentation summarizes the major pedagogical innovations of the TeachScheme!, ReachJava approach, reports on the results of our past faculty workshops (particularly the adoption of our approach by respected colleges, universities, and high schools), and invites visitors to a free (NSF-funded) faculty workshop in Summer 2010. Several textbooks and other instructional materials using this approach, e.g. (Bloch, 2010), (Felleisen F. F., 2008), (Felleisen F. F., 2010), (Felleisen F. F., 2001), (Sperber, 2009) will be available for examination. A first course in computer programming should not be about the current "hot" language in industry -- which may be obsolete by the time today's freshmen graduate -- but rather about lasting, transferable concepts and practices of good programming. Yet beginning programming students spend much of their time wrestling with the language, and often mistake that as the subject of the course. The programming language distracts from the course material; on the other hand, students need a real language to write real programs that really run on real computers. We resolve this dilemma by starting in a language with simple, consistent syntax and semantics, currently a subset of Scheme (omitting I/O, assignment, sequence, higher-order functions, and local definitions). Our pedagogically-oriented IDE enforces this subset, and gives error messages appropriate to the current subset, but allows students as they outgrow each subset to advance to a larger one with a few mouse clicks. Students become comfortable with fundamental programming concepts --- variables, function composition, function definition, parameter passing, data types, design for reuse and modifiability, conditionals, fields, polymorphism, self-reference and recursion, functional abstraction, event-driven programming, model/view separation, etc. --- in this sheltered environment before encountering the same concepts in the more bewildering world of Java, C++, etc. Simultaneously, students are trained in a step-by-step design recipe for software development: a series of concrete questions, with concrete products at each stage: 1) Identify the purpose, inputs, and outputs of the program (function, method, whatever) to be written; 2) Identify (and, if necessary, define) data types relevant to the problem at hand; 3) Write examples or test cases of how the program will be invoked, in legal syntax and accompanied by expected results, using the data types from step 2 as a guide; 4) Write a program skeleton, the syntax to define a function with the name and parameters chosen above; 5) Write an inventory of available and likely-to-be-needed expressions, based on parameter names and their data types; 6) Choose and combine items from the inventory to form a complete program body (the hardest part, but in practice step 5 often does most of the work); 7) Test the program by running it on the examples from step 3. We emphasize data types throughout, not only as a fundamental concept, but as an invaluable tool in coding: to every data type correspond both a natural coding pattern, which provides a rough draft of the code and helps students avoid "blank page syndrome", and a natural testing pattern, which provides guidance in building test suites. In particular, recursion is introduced as simply the application of already-learned coding patterns to a self-referential data type. The concrete methodology also provides a handy grading rubric that shows students that every step matters, not only the coding. For non-majors, we aim to convey important programming concepts and methodology in one language. For CS majors, the course switches from Scheme to Java late in the first semester or between first and second semesters. The Java stage is not independent, but builds on and reinforces the programming concepts and methodology already learned in Scheme, with explicit discussion of similarities, differences, and the continued applicability of the concepts and methodology. Students learn to apply the same test-driven, step-by-step design recipe in Java that they've been using in Scheme. The result is a student who, after a year of coursework, can approach programming problems in a principled manner (not "hack it until it works"), with understanding and perspective. Although we currently use Scheme as a first language and Java as a second, the approach is applicable to other languages. Whatever the language, however, we believe the first exposure to programming should be functional rather than imperative/sequential/procedural: not only do functional programs have simpler semantics, relying on the familiar model of algebraic expression evaluation rather than a load/store machine model, but it's enormously easier to write test cases for functional programs than for stateful ones. Stateful testing, along with stateful programming, can be introduced late in the first semester after students have thoroughly internalized functional techniques. Our approach has been adopted at a number of colleges and universities, including Rice, Northeastern, the University of Chicago, Northwestern, the University of Utah, Cal. Poly San Luis Obispo, Vassar College, and the University of Delaware, as well as dozens or hundreds of high schools. We'll be offering free (NSF-funded) one-week workshops in Summer 2010 at four locations around the U.S.