THETIS: AN ANSI C PROGRAMMING ENVIRONMENT DESIGNED FOR INTRODUCTORY USE Stephen N. Freund and Eric S. Roberts Department of Computer Science Stanford University ABSTRACT As we have reported Commercially available compilers, particularly those used for languages like ANSI C that have extensive commercial applicability, are not well-suited to students in introductory the change computer note that the concerns science sophistication alleviate that this Thetis courses beginning problem use. system associated user interface and easily understood capabilities. fulfills provides a significantly students 1. of students we undergraduate with time learning On further and discovery: for language Pascal in CS l/CS2. than INTRODUCTION When the Stanford its CS l/CS2 strongly the C-based department, as more members, Ironically, reservations about of the lecturers introductory only who would that Pascal students to adopt needed C were be responsible There was little saw both for there C and the and use. extensive for students solving and algorithmic expressed more to master it, of their was that time the more design. “students debugging important from environment of the provided of the The easier revised clearer to use course, The Pascal diagnostics, that was much better a change in language—that of course project tools specifically Thetis mythology—was quarter we decided computer christened introductory Thetis that the best was to develop designed science after to address students. the sea (C) That nymph used on an experimental 1995 and then adopted for basis the entire in the spring. This paper and our experiences using it at Stanford. describes the in the 2. it harder SHORTCOMINGS OF their the learning EXISTING earlier problem time for learning.” Permission to copy without fee all or part of this material is granted provided that the copies an? not made or disbibuted for direct commercial advantage, the ACM copyright notice and the tiUe of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise or to republish, requires a fee and/or speeific permission. SIGCSE ’96 2f96 Philadelphia, PA USA Q1996 ACM 0-69791 -757-X/96/0002 ....50.5O papers process [Ruckert93, is that languages most like C that designed As a result, of these most for cater environment beginning have students is been recognized Schorsch95]. commercial programmers—are student COMPILERS in the programming not a new one; such shortcomings issues of problem less for debugger of introductory Greek in winter The fear, as one lecturer would end up spending and was much of inadequate complicate make higher a function programmers. consideration, to the problem by using would in their environment. of the programming The idea that weaknesses course on of their errors It was these factors—not curriculum than they had in the past. The concerns were focused instead on whether the added complexity imposed C in the introductory fraction was often less adopted an interactive project—since in anyone’s earlier seminar we made an important was errors, and structure After solution one or two that we more to student the needs obsolete C++ to When made the difference. significant was no doubt however, beginning detected the syntax students for teaching question increasingly Likewise, to learn any level we had abandoned a programming to express was becoming to be replaced. prepare of we determined obscure frustration frustration the C compiler suited attitude shared by and outside the would a a larger of the programming compiler and included work. people the decision courses. for students in year, relatively most it is important foundation. its initial spending down examination, than compiler constituencies In particular, relevant—an both inside for advanced the decided of instruction of the affected who felt that the change more effectively needed most the change. material faculty Science C as the language sequence, supported many mind ANSI of Computer so, course after indeed student particularly Department in 1991 to adopt were to track in fact achieved not without C-based Roberts95a], on the computer as a result. indicate environment the teaching trying effect Even were code and that the student simple and visualization and instructors anticipated. evaluated that students for we set out to accomplish better To and [Roberts93, and that we have we the specifically students program the benefits of developed of a C interpreter debugging, the goals a level do not possess. designed consists editing, assume we have that provides Reactions that Thetis students environment The they at Stanford, programming student because science elsewhere to C has had a positive The in underlying compilers—particularly to for experts compilers a large rather audience of than novices. are poorly suited to use. In our experience, commercial compilers suffer from the following problems when used in an introductory course: compilers “ The error messages generated by commercial are often uninformative and sometimes misleadittg. New 300 programmers tend to make others. example, For certain omitting mistakes a required more often than semicolon or right curly brace Unfortunately, by reporting below is a very compilers a seemingly the actual does not detect file. Expert where error unrelated mistake. syntax the problem until understand novices error Although error several lines to address point the parser section, in the source practical the problem are completely and know baffled. little or no run-time identify bugs that are error confusion, the greatest logic that frustration are a source for system students never pernicious common outside comes from In the detects. because Even helpful to novices, rarely errors the bounds pointer. C, compilers run-time such such experts errors problem is especially generate code to detect are unwilling avenues are available. would its goals decided ● to pay the cost. tt’as pedagogical that offer fact of not run at primarily if making debuggers sophistication. The Stanford, for example, character pointer—a you understand usually require commercial C compiler displays string representation how a high we use string data internally. goals many the “ (k-pedagogical In until depends pedagogical end. While the failure sense, present string data restricts the utility in an this strategy makes of the debugging understandable good tools way that are C’s of the debugger. effective .. w’hetl environment. to a large extent products must all the resources developed locally, available on programming to support such integration. environments advanced the machine, typically overwhelm and offer flexibility. To inadvertently main language By that problem are later run-time run information of from and debugger during have limited compilation. Interpreters itself into incur the access a single the no need to achieve would simplicity gladly sacrifice and reduced maximum some run-time execution debugging for the to ensure that models, it interpreter was be unlikely new ideas in the design et?vironment. and dynamic we identified in the future, visualization. Exploring a research Although much the prospect a strong For the relationship that we develop and modify. of a In the as experiments. in exploring is to take cslib would design, of prepared Because useful C libraries mask much To products interested We had a team of students the incentive interpreter imaginations tool of this of undertaking to implement and importantly, extremely time. design 3( fully the [Roberts95b]. The and enthusiasm there iri taking integrated program than idea for use in the introductory competent interested students-–even more teaching idea in recent memory. the project and sought greater Mvho were Stanford, level—are science institutions penalty At project. computer an phase in efficiency speed the a preliminary provided w’itllin better conflicting of seemed extend remains are by several space required undergraduate to the in execution efficiency that makes them inappropriate for writing production code. Introductory students, however, have debugging ● program a significant between on phase. the By contrast, simulates therefore Because year, interpreter. instructions process. per in teaching temporarily programming that we were such research inte,erated ., success definitions. developing features research it hard is CS of platform. Our commercial to explore that we could users need. the execution these operations interpreter makes cslib based design a change well components example, this commercial machine as an independent combines the execution. generates if confused all the We wanted process-of or incompatible producers of several severe not pedagogically of the program. technology generated interpreter which incorrect that beginning phase is separate system ● features more of feedback a compiler compilation that understanding becomes execution facing special limits is that compiler the kind definition, these chooses successful systems to provide user interfaces that The problem that prohibit The student, complexity and self-confidence. options complex account who has no use for the added power the additional the student commercial have the beginner represent programmers do which introductory representation. students for systems 1200 students students cotnpilers offer a bewildering set of options “ Commercial and special features that are useless to the novice and Because their occasionally cause consistency problems. are The which until the underlying important those on campus, on the use of the cslib Roberts95a], complexity understand [CenterLine95], we seek, over out’ Even approach depends on the use of libraries most [Roberts93, to severely both C interpreters, product to contemplate both to reasons: satisfied commercial available enroll computer project, requirements. Macintosh. at Stanford programming to the Apple it infeasible our course, we introduce strings as an abstract type very the underlying representation early in the course, deferring close hardware CS298 In the end, we that CodeCenter of the features on the other of the of Stanford’s hardware to buy that if for the following system and our project the dimensions interpreter a software undergraduate the project it is possible courses sense only any and to assess its feasibility. such as CenterLine’s data as a hexadecimal that makes C represents level though teaching no existing represents particularly quarter the proposed to undertake There ● Interactive debuggers typically require students to understand advanced cotl cepts before they are ready to is further complicated by the assimilate them. Debugging that existing on so made are, the scratch is a major lightly, an entire evaluating preceding doing Building sure that we understood “Seminar science,” be from strategy. undertaken we spent course, an invalid checking be that as the shortcomings of this scale and complexity not a C interpreter in lhe clear serious solution should refine identified Immediately As ambitious problem, an element or dereferencing run-time not A C INTERPRETER to design a new C interpreter To make the BUILD possible shortcomings sense. system misleading as selecting of an array though Although of early the it was rather TO it was certainly idea of writing C compilers offer “ Commercial checking that would help students otherwise extremely hard to find. messages DECISION to this because that 3. THE in C programs. respond presumably programmers to look; common sometimes more of a core students and implementation. who of many a C captured any other highly wanted The existence the at Many students contributed to become more involved. was the building classes than at into their project ideas to More motivated, to drive of that group the of students meant how usable else, the AN enhance from their OVERVIEW “succeed” turned would of experience significantly would system implementers amount 4. that the project the final out have doing Strengthened no matter One to be; if nothing gotten in an introductory an enormous the project that legal would . . . Thetis was a faithful mother to [Achilles], aiding him in all difficulties and watching over his interests from the first to the last. Thetis is a complete, Hamilton, integrated that “aids students interests” by providing in their development difficulties and watches a conceptually simple, environment in which to learn programming. respects, Thetis presents a conventional user student what creates files source make in a project program files in editor up the application window, through by listing a menu-driven contrast, Thetis because its effect intended. strings flags Other using and failing enabled—as it is for to that make line common of the line: fewer of by constructs is i In default, the student likely operators to be to compare prototypes. syntactic checking in Thetis for the syntactic restrictions of When checking is [Ruckert93]. errors variable as FALSE. not what function the The as an error relational to those outlined programming legal. for enhanced C differences most by the following certainly to include The arguments Educational similar this examples include the contents The major as always = in place is interpreted is almost are similar of the operator is perfectly O, which indicates the execution interface application. statement the value erroneous In many interface: a windows, and then controls used by any Macintosh over their yet powerful, regard are almost The students. as illustrated =, C or C++ O)... assigned environment by using languages that the assignment operator In C, this Mythology is that these constructs written if(i= by instructors course is using relational restrictions faced syntactic when example THETIS —Edith certain errors own education. OF syntactic of the problems such introductory classes—students and can concentrate on developing better skills. are that Thetis ● Automatically incorporates so that students ● Offers ● Provides the cslib need not be concerned significantly enhanced a convenient Thetis with Run-time libraries, For them error that operates at syntactic errors little In his error discussion reporting of errors Schorsch notes the syntactic His in error commercial messages much generated reported by many are similar own environments feedback with simply are designed than the For example, usual c often = ● Using ● Dereferencing ● Accessing ● Assigning like “type mismatch” gives no helpful information regarding problem, and the second phrases the error may not comprehend. message value this for of type example messages makes from string may in a similar it much their or “assignment easier message The first programmer: to a variable appear trivial, fashion, for “cannot of type enhancing as we have novices done to understand all find this burden, run-time are arise, offering bugs the in Thetis errors: variable an invalid value function Calling a bad function ● Passing invalid pointer to an enumerated without returning type a value pointer arguments and to a function visualization experience has shown needed program to present to novices to present tools that debuggers a clear information in a way that programmer’s level of understanding. the learning Thetis about a While error in Thetis, and learn mistakes. 302 for so that it builds which students are already familiar. diagram, for example, shows a Thetis view By contrast, is consistent curve do not have conceptual [Birch95]. of a program we have designed error assign char. ” all C environments programmers an out-of-range To minimize the cause of the in terms a student Thetis provides a more suitable a beginning of after an array out of its bounds is designed errors phase persist such errors reduce or freeing a non-void Previous the lines from pointer without cast.” Neither useful to the introductory student. when for the following an uninitialized Debugging terse ; generate that by zero ● running makes integer is particularly frustrating corrected. help To most errors to c; Ha,, to checks Dividing the features char been code. ● “ Exiting by novices. by Thetis by compilers. and Tom compilers. to our understandable reported better analyzing have comprehending commercial messages for [Schorch95], students error messages user utility programs Pascal C compilers: error the CAP messages with do not provide The the Pascal the difficulty experiences give reporting have feedback interpreter Improved the the logic not very useful misbehaving provides. students, is finding traditionally to the students’ understanding expand on the most important detection introductory debugging error detection debugger/visualizer a conceptual level appropriate The sections that follow new features and ANSI the execution with new of a Thetis state the novice programmers, on paradigms The following editor window: with screen The window’s user left has placed mouse. The margin. Each because array line contains about has an arrow is not confronted options that students are much the In this example, of the several different in the Moreover, with also includes special advanced also willing to use the allowing visualizer modeled more for Finder students. The interface, following of the visualizer diagram is familiar to illustrates the test students correctly The Thetis two Data developed II V 4 prbc4+ssLine ❑ ❑ ❑ ❑ I word “verb inl%.etmklw TRUE teaching start 4 uninitialized ~ 3 PrmessMadlibsFile In I II using winter students the material of basis with in can be turned window with extends left of variable to view variables names next This The to in that opens in it. as well. represent arrow the variables a function and structures and Our for strings, experience develop indicates a new any icons to the The concept conceptual scope of a call understandable model of variables, stack that students of how find helps their parameter are all programs usage, presented the them and the in an accessible, way. debugging Listener, which allows the program the to create available students runs. variables from illustrated in the following to the programmer to evaluate These program, and diagram: expressions even prototype were integrated the initial version was dedicated in the of to testing seminar course considerable their is the any expression can function include calls, as used of CS 106A on as the user Thetis on an approximately course, 30 which CS 1 curriculum went we found covers [Austing78]. opportunity to damaging extremely refine bugs the before it course we in use either was the success for the following students of CS2—to the using which to use Thetis students) allowed advantage Given an enjoyed and pointers, time. we decided (300 Through students important on arrays debugging well. that most that the most experiment, CS 106A we saved of the the entire quarter. In CS 10613-Stanford’s Thetis or ‘THINK C for assignments. To measure survey of quarter of relatively student students 1995, small. reaction enrolled when, to the tools, in unfortunately, The results in the enrollments Yes were No I 0.070 100.0% Thetis easy I Were YOUever confused about how to do “something in Thetis? I 66.770 33.3qo I I Do you feel that Thetis has helped you understand pro~ramming ? 71.8% 28.2qo Do the error messages reported by Thetis help yx4 find mistakes in your programs easily? 82.0% 18.070 From Thetis the reactions, is positive. students enrolled introductory and CS2 THINK revealed in course into C. a single With it is clear This same combines quarter—who this audience, the following: that student survey was response also CS 106X—Stanford’s that a summer are as follows: I do you find we conducted CS 106A N=39 tool a components us an error checking III general, to use? Listener Another of 1993-94: and potentially quarter and felt run-time addition, the types of the variables: easy to use, but also that its structure a solid work. components use. survey, Thetis initial metaphor and so on. not only over the past and winter a group ACM gave fix first equivalent integers,!@ visualizer while has a folding on that function’s to arrays ❑ for The down Double-clicking of Andy of two 1994–95, large the experiment That function. Arnold) consisted the fall group Freund, the participants in Stanford’s informal it which a small of the introductory quarter faced widespread stack PROJECT by and Perry and summer and the staff system on the call THETIS The fall of 1994–95 experimental This function code, written by community. El Each additional These and refinement, i to write debuggerlvisualizer. the interpreter. * 1“ function parser/evaluator the spring refinement (Stephen during the Listener written preliminary during Providing a newly phase in parallel or writing that was Becker, source of [he the program continuing initial on Listener, stepwise OF THE Brian the of undergraduates The is tested using determine test cases. interpreter years. a and to verify EVALUATION 5. By restarting notion before Montgomery, Program functions repeatedly the function values. code for running Stanford in Thet~: input reinforces works which can the IsPalindrome without a baffling intended a program students errors than they have been in the past. the Macintosh operation where click is self-explanatory. complicated The debugger Stanford sign a simple to be executed the programmer debugger a stop with of these icons of more use, we find after margin a breakpoint to accelerated the material were to given from CS 1 programming the corresponding questions in I N=26 In general, do yoLl jind THINK easv to use? Were you ever confused aboat how to do something in THINK Do you feel that THINK helped you Yes I collective impression lectures are augmented I 69.2% C? No 26.9% I 73.170 C that Thetis ~6,970 73.1% C has for students ing ? Do the error messages reported by THINK C help you find mistakes in your programs Despite that stronger counterparts in those contrast Over helped them find When CS 106B environments, manv users mistakes, students said while fewer than execution 20 despite students who switch ‘its the choice between OUted to use Thetis for their slower started to THINK &xecution an assignment C to take speed. with advantage with engineering. portability in mind the immediate indication and programming the helper using fewer concentrate Sahami, students spent When on it. quarter of 1995, programs were significantly, teaching less assignments students how Thetis than during Release value allows easily. Gerald section office hours Michael Guide, class R. the class they Cambridge, during class, checking demonstrations program of the ACM, D. editing education: The results al., in March “DYNALAB: infrastructure Bu[[etin, A featuring March, Corporation, MA, structure [Roberts95a] people allowed and bugs more is also auDarent. 1995, CodeCenter User’s 1995. R. on Goldenstein, “The introductory impact computer of science SIGCSE Bulletin, so far,” p~~grams September Mythology,Boston: Eric “Using T/ze Art S. Roberts, experience,” Martin C,” MA: courses: Ba[[etitl, Ruckert Bulletin, and 1993. of C: A Addison-Wesley, Lilly, as teaching SIGCSE S[GCSE March and Science John undergraduates Little, C in CS 1: Evaluating Bulletin, Reading, programming “Educational “Using SIGCSE S. Roberts, [Roberts95b] [Ruckert93] Lecturers Eric Ai]proach, Stanford new S. Roberts, Librarv-Based 199.5. introductory supplementing lecture notes with real programming examples. we have no direct evidence to support the in-class et [Hamilton42] Edith Hamilton, Brown and Co., 1942. the but the better sections. of 1989. on the average. for presenting and run-tilme laboratory SIGCSE [Goldenstein89] poll.” the summer and grade formatting the undergraduate CenterLine experience,” tool to use Birch, science Eric to debug enhancements [Goldenstein89] Cot]ltlllftzicatio?ls [Roberts93] or discussion for demonstrations for science,” the Stanford staff of slower Austing, Bruce Barnes, Della and Gordon Stokes, “Curriculum Recommendations each to the course leaders Richard Engel, more usual, its REFERENCES to finish than by platforms Perhaps hours these advantage help system for general usual. It is also an excellent during use Thetis of Thetis to other the system Rollins, The topics Port Thetis ● animation,” quickly, more ● on-line required support from the programming environment to move beyond simple misunderstandings Thetis to support [CenterLine95] thought by the believe 1979. to program generally at times needed automat]c the visualizer [Birch95] and time to released five We editors Enhance program much to provide ● to step over he asks and how of time no easier the following stylistic, hurdles a “pain by one or two were to make an effective computer evaluates that people painful frustrated in structure-based dynamic at Stanford, with becoming more syntactic, ’78: common by conducting be to take full Develop computer or accessing and painful it was he noted dropped allows at Students find students the text editor Bonnette, own and therefore in an assignment, painful the amount assignment The a lecturer hand how their goal of learning on assignments collectively to paper. been utilization. over the next two years: [Austing79] introductory a variable confusing on the main performance When Thetis often reduced cluster. will the memory in this allow memory which less than half will important have runs approximately Provide to fit asked by students able initializing array element-on yet taking computing generally as not questions. Mehran tools Thetis, of 1995, ● to program has successfully are the questions were an out-of-bounds small, how development in several challenges ● run of their lesson in to choose of students in the main of without Extend 7. that Thetis classes cubicle Thetis these and also how frustration mistakes—such asked learned Thetis our and reduce discussed the sort found task at hand. Another the stress Students version and requires Thetis would faster and environment performance. Often, Thetis of the times when they were doing the final fine-tuning programs. This practice constituted a valuable software efficiency We also intend given we believe learning the system technical in the fall Thetis ● programs next improvements the error better continuing primary implementation of error PLANS in the last year, we set out to accomplish to improve increase faster The however, Our Stanford when in CS 1/CS2. are, and expect The trouble the goals in better in Thetis. FUTURE a significantly ways. C. were students more a their in CSI 06A. the usefulness of Thetis said the same of THINK y have than having Thetis concerns 80 percent typical] computing using significant messages in CS 106X they reported most percent students background C than THINK messages. work in CS 106A, using We 80.8% 19.2% easilv ? the fact much fulfills that it provides understand ]rogramm AND On the basis of our experien~e I 1 ideas sink by demonstrations CONCLUSIONS 6. 30.8% is that new An and update March on Halpern, 1993. [Schorsch95] Tom Schorsch, “CAP: An automated assessment tool to check Pascal programs for syntax, Although claim, our and style 304 errors,” SIGCSE Bulletinj March in the 1995. Richard March Bryan assistants 1995. selflogic.