Learning Connections Student Voices & Computer Science

Programming as a Second Language

By Justin Solomon Subject: Computer science, foreign Understanding the concepts and development language of programming can benefi t students by demand- Grades: K–12 (Ages 5–18) ing precision of thought and requiring students to clarify and improve on their problem-solving Technology: Programming process. The goal of beginning programming Standards: NETS•S 1, 3; NETS•T II; instruction should be to introduce the subject NETS•A I (http://www.iste.org/stan- dards/) in terms familiar to students.

34 Learning & Leading with Technology Volume 32 Number 4 Copyright © 2004, ISTE (International Society for Technology in Education), 1.800.336.5191 (U.S. & Canada) or 1.541.302.3777 (Int’l), [email protected], www.iste.org. All rights reserved. Student Voices & Computer Science

tandard methods of teaching an With simple adjustments to methods introductory course in comput- of programming instruction, students er science, designed to intro- could be shown that linguistic terms, Sduce computer programming as a tool such as specifi parts of speech or ele- for mathematicians and engineers at ments of grammar, can be common the university level, are unnecessarily denominators in computer program- complicated and diffi cult. Th ey lack a ming. Using spoken and written common thread that unifi es each unit language as a metaphor for program- of material and frequently make use ming can show commonalities and of mathematical notation, technical diff erences across programming lan- keywords, and other terms or symbols guages, the correlation among these unfamiliar to the average middle or diff erences, and the repetitive patterns high school student. Furthermore, of the correlations. In addition, this they tend to focus on a single more concept can be adapted to reduce the advanced language, leading students intimidation factor of introductory to believe that each programming programming, making it accessible language is a distinct and separate to students from all backgrounds, entity with a tenuous—at best— ages, and genders. With this model, link to other languages. Ironically, introductory courses in computer traditional high school-level computer programming are more likely to science classes are often driven by the provide a solid basis for students in Advanced Placement (AP) curriculum all algorithmic thought, as well as dictated by the College Board, which a foundation for progress to related establishes a narrow set of bench- applications and extensions, possibly marks for evaluating profi ciency in including more advanced languages computer programming. According with specifi c advantages and particu- to research done by Allen Tucker, lar uses. these benchmarks promote memori- According to research conducted zation over understanding and are of by Letitia Naigles, students intro- limited practical use to the average duced to foreign language at a young student. (Editor’s note: Find this and age fi nd it easier to acquire profi cien- other Resources on p. 39.) As a result, cy in that language. Th e same holds students view programming as more true for computer programming. of a snapshot than a continuum, Although programming has become failing to see the value in pursuing an important subject for high school a higher level of programming and students to learn, there is no reason computer applications profi ciency. it cannot be introduced earlier. As a To meet the educational require- discipline, it provides students with ments of a wider and increasingly a unique way of thinking based on younger audience, computer pro- logic and reasoning. A rudimentary gramming instruction needs a com- understanding of the concepts and prehensive overhaul, with the goal of development of programming can fi tting into school-based curricula as benefi t students by introducing them a “second language,” starting as early to such topics as stepwise refi nement as the elementary years. To begin the and the use of documentation. It process of revising computer demands precision of thought and science curriculum, the goal of begin- requires students to clarify and im- ning programming instruction should prove on their problem-solving be to introduce the subject in terms process. Programming has applica- more familiar to the average student. tions in almost any fi eld, from lan-

December/January 2004–05 Learning & Leading with Technology 35 Copyright © 2004, ISTE (International Society for Technology in Education), 1.800.336.5191 (U.S. & Canada) or 1.541.302.3777 (Int’l), [email protected], www.iste.org. All rights reserved. Student Voices & Computer Science guage arts and design to architecture, languages and the languages they his or her needs and desires. Unsur- and could be viewed as the basis for speak, students would have greater prisingly, the vocabulary and struc- any type of computer use. Even the ease in remembering how to code as tures used to form these demands most fundamental knowledge of well as fewer syntax errors. Drawing are usually quite direct, as most programming can prove helpful to connections between program syntax toddlers do not have a deep under- students working on multimedia and punctuation, between language standing of complex grammatical presentations, classroom projects, structure and grammar, students can structures. spreadsheets, word processing, or recognize programming problems in Programs written by novice com- data aggregation. their everyday lives, making abstract puter science students follow the Unfortunately, the somewhat ar- topics much more concrete. Th ey will same pattern. Beginners fi nd it hard chaic model for lessons in program- have the ability to take an algorithmic to accept that certain statements are ming tends to target older, higher- and logical approach to problem-solv- necessary without understanding their level students who already understand ing both inside and outside the tech- purpose. For example, consider the the abstractions and jargon used by nical realm. following program written in Java, a computer technicians. Th is frequently After they make these connections, fairly complex leads to discouragement and failure students will be able to communicate popular for introductory classes in among younger students who might in the language of the computer how computer science: otherwise benefi t from knowledge of problems can be solved in the most computer programming. Chris Ste- import javax.swing. phenson’s recent survey of high school JOptionPane; computer science teachers reported 1000 100010011 that many of the schools that do not public class SimpleProgram off er computer science instruction 1000 100010011 { decided that it was a fi eld best left to 1000 100010011 public static void colleges and universities due to “aca- main(String a[]) { String answer; demic rigor.” Th is notion is unfound- 1000 100010011 answer = JOptionPane.s ed. Many students in both elementary howInputDialog(“What is the and middle school are profi cient in 1000 100010011 password?”); programming, even though they do if (Integer.parseInt(a not have the traditional technical or 1000 100010011 nswer) == 123) mathematical backgrounds. JOptionPane.showMess According to Peter Van Roy’s basic 1000 100010011 ageDialog(null, “Correct”); constructivist model of education, else students who study computer sci- effi cient way possible. Programming JOptionPane.sh ence as an extension of what they will be much easier to understand owMessageDialog(null, “Incorrect”); already know tend to gain a deeper and it will become less problematic to retain the large amounts of knowl- } understanding of the subject material. } Also, Nicola Henze and Wolfgang edge needed to write useful programs. Nejdl found that students who learn Integrated into other classroom work, Th is code is hardly readable. Most answers by rote are less likely to un- computer programming can be a use- beginning programmers do not know derstand or apply them. For these ful, creative, and thoroughly enter- how or why methods are declared, reasons, a common-sense model of taining second language for students yet alone what it means to call them computer science education would at all levels. public, static, and void. Also, a single use something any student can un- typo in this and most other Java pro- derstand: language. One must learn First Words grams could result in any number the basic constructs of a language and According to the American Speech- of cryptic errors, from the simple how to manipulate them to be profi - Language-Hearing Association, after unclosed string literal to the terrify- cient in any language, be it designed simple nouns, the fi rst words typi- ing thread death exception. In fact, for communication among comput- cally used by infants are commands. running the above program with the ers or humans. If a computer science Straightforward and largely uncom- input “wrongPassword” will make it curriculum encouraged students to plicated, these commands are just stop running and output the follow- make connections between computer enough for a young child to convey ing error message:

36 Learning & Leading with Technology Volume 32 Number 4 Copyright © 2004, ISTE (International Society for Technology in Education), 1.800.336.5191 (U.S. & Canada) or 1.541.302.3777 (Int’l), [email protected], www.iste.org. All rights reserved. Student Voices & Computer Science 1000 100010011 easier to read and to write. Th ey look eryday language and back. Th is type closer to a set of directions given of work emphasizes the relationship 1000 100010011 from one person to another so that between programming and real-life they could be read from top to bot- situations. It also will encourage the 1000 100010011 tom without much interpretation. student to recognize the “punctua- Also, every command has a clear pur- tion” of coding, and that there are 1000 100010011 pose, making the debugging process several elements that make a program straightforward. No “keywords” are acceptable to the computer but still 1000 100010011 required to precede certain state- readable by humans. ments, and the programmer does 1000 100010011 not need to surround blocks of code Recognizing Verbs and 1000 100010011 with any type of bracket or brace. Ev- Other Useful Parts of Speech erything runs from the beginning to Th e necessity for more complex com- Exception in thread “main” the end, one line at a time. Th e im- munication drives children to con- java.lang.NumberFormatExce mediate feedback provided by writing struct longer sentences by stringing ption: wrongPassword short programs and observing their more meaningful words together. De- at java.lang.Integer.par output helps students recognize the spite their utility, commands alone do seInt(Integer.java:426) importance of every set of program- not convey action, provide a name or at java.lang.Integer.par ming skills in the context of their label, or describe anything in detail. seInt(Integer.java:476) own computer needs. Th is prevents Th us, new language-based constructs at SimpleProgram.main(Si students from memorizing code seg- include at least a subject and a verb, mpleProgram.java:7) ments without understanding how and often incorporate modifi ers and Almost every type of simple error they can be used. adjectives. comes with its own confusing name Diff erences in readability alone are Th ese terms transfer directly to and “exception.” Forced to explain enough to make a compelling argu- basic structured programming tech- such obscure packages and “features,” ment for the use of simple interpreted niques using subroutines and func- Java reference manuals are often languages by beginners. Several such tions. A subroutine is like a pronoun. dauntingly long for the average stu- interpreters are freely available or for Subroutines represent segments of dent. Many times these errors are so a small price on the Internet. Th ese code that can be reused to perform long they scroll off the console or out- languages, including any member of the same calculations or output every put window. Now observe a similar the BASIC family, make it easy for time they are called. Th ey encourage program in BASIC: programmers to focus on the diff er- new programmers to avoid cutting ent structures, commands, and algo- and pasting similar blocks of code for PRINT “What is the rithms without concerning themselves a more sophisticated model. Similarly, password?” over the form or style of their pro- pronouns are used to shorten the INPUT password grams. Th ey encourage the develop- names of their antecedents. Pronouns IF password = 123 PRINT ment of good programming style and could be replaced with the noun they “Correct” are similar to the pseudocode used in represent without changing the mean- ELSE PRINT “Incorrect” more advanced textbooks. Also, Mar- ing of their context. In the same way, or its counterpart on a TI-83 celo Zanconi and his colleagues found calculator: that the use of simple programming 1000 100010011 languages encourages teaching the PROGRAM: PASSWORD programming process instead of the 1000 100010011 ClrHome features and peculiarities of a particu- Disp “PASSWORD?” 1000 100010011 Input P lar language. If (P=123) Once students have learned basic 1000 100010011 Disp “CORRECT” syntax rules, they should be able to If (P≠123) read their programs like normal text. Disp “INCORRECT” 1000 100010011 An eff ective exercise would be to pre- Th ese programs have one-third to dict the output of programs before 1000 100010011 one-half the number of lines of their running them and to “translate” pro- counterpart in Java and are much grams from computer language to ev- 1000 100010011

December/January 2004–05 Learning & Leading with Technology 37 Copyright © 2004, ISTE (International Society for Technology in Education), 1.800.336.5191 (U.S. & Canada) or 1.541.302.3777 (Int’l), [email protected], www.iste.org. All rights reserved. Student Voices & Computer Science every time a subroutine is called it has Recognizing Nouns work on progressively more diffi cult the same “meaning” to the computer Th e next structure covered in most problems, each focusing on the fact and produces exactly the same action. computer science classes is the object. that an object should be made for Functions, on the other hand, are Objects are abstract representations every prominent noun in the program more like verbs. Functions, called of all the functions, subroutines, and description. Soon, they will be able methods in Java, take one or more data related to a specifi c item or con- to apply object-oriented design to ap- parameters and somehow manipulate cept. Th is model requires program- plicable programming situations and them to eventually return a single val- mers to group their functions and to understand the concepts of and ue. Similarly, the subject of a sentence data members by purpose. OOP reasons for encapsulation. aff ects or changes the object through has become widely popular in recent At this point, more advanced con- the verb. Functions change their use years and has led to many diffi cult cepts of OOP such as inheritance, and meaning depending on their pa- lesson plans. In fact, it has even been polymorphism, and abstraction can rameters and can be used repeatedly cited as a top reason why students be introduced individually by relating in the context of a single program. drop their programming courses. them to linguistics. Inheritance deals Verbs also change meaning depending Other than the traditional “black with the classifi cation of nouns and on the context of the sentence. their related verbs. As specifi c nouns After students have a complete 1000 100010011 are grouped together, they will form understanding of the programming categories, which can be represented “sentence structure” and control over 1000 100010011 by abstract objects. For instance, “tri- simple data structures, it may be time angle,” “square,” and “pentagon” could for them to move to a more powerful 1000 100010011 be classifi ed under the more abstract language that supports such para- noun “shapes.” Such simple relation- digms as object-oriented program- 1000 100010011 show naturally the need for such ming (OOP) and templates. Because 1000 100010011 complex models as polymorphism, they have already studied constructs which deals with treating all child used in almost any language such as 1000 100010011 classes the same by using the member branching and looping, it should not functions common to all of them. For be hard to transfer their skills. Now it 1000 100010011 shapes, functions that calculate area should be more obvious, for instance, and perimeter could be called without why the main() exists in C++ box” lesson about objects and classes, knowing which specifi c shape the or why most Lisp programs start with there are hardly any resources avail- computer was referencing. several function defi nitions. able to help teach this particularly Perhaps the best way to introduce abstract topic. Communicating Ideas students to new languages is to have OOP, however, could be viewed as No language is useful unless it can them write the same program in the a programming methodology that fo- be used to communicate ideas. After language with which they are already cuses on nouns rather than on verbs. all, it is not the individual words that familiar and in the new language. As To relate objects to nouns, students give a sentence or paragraph its mean- a result, they will notice that diff er- could list all of the actions, informa- ing, but rather the specifi c sequence ent programming languages are used tion, and manipulations associated of words used. Likewise, learning the to express the same idea in diff erent with a certain noun. Th en, they could syntax of a programming language is ways. Also, they should compare the combine their prior knowledge of useless unless it can be applied to the features of the two languages and hy- programming techniques and simple creation of useful, or at least enter- pothesize when it might be advanta- algorithms with a short lesson on the taining, programs. geous to use one rather than the oth- syntax of objects and classes to actual- Th ere are several ways to approach er. As students will soon discover, the ly implement a program that, on the the problem of creating sample situ- linguistics of most commonly used most basic level, acts like the noun ations that could be solved using a programming languages are related. they chose. From there, students can computer program. Regardless of the

Reach for the Stars of education! Advertise in L&L. Contact Danielle Steele-Larson or visit http://www.iste.org/ll/about/ to fi nd details on advertising in ISTE’ISTE’ss fl agship publication.

38 Learning & Leading with Technology Volume 32 Number 4 Copyright © 2004, ISTE (International Society for Technology in Education), 1.800.336.5191 (U.S. & Canada) or 1.541.302.3777 (Int’l), [email protected], www.iste.org. All rights reserved. Student Voices & Computer Science 1000 100010011 ture or algorithm and combine with code is a very rewarding process that previous lessons. Traditional lesson will provide the student with skills 1000 100010011 plans that could benefi t from this he or she can use for life. If started process would be ones that involve early enough in a student’s academic 1000 100010011 simple algorithms such as search- career and taken out of the context ing, sorting, and fi le manipulation. of achieving a higher score on a stan- 1000 100010011 dardized exam such as the AP test, Th ese concepts are important not programming can become as natural 1000 100010011 only in connecting the programming as bilingual fl uency earned through world with the real world but also in the study of a second language. 1000 100010011 honing students’ generalized problem- solving skills. Th ere are several diff er- 1000 100010011 Resources ent ways to word a sentence, and it is American Speech-Language-Hearing Associa- important that one can understand tion. (1997–2004). How does your child size or type of problem, however, the any type of sentence structure. Simi- hear and talk? [Online document]. Avail- following principles will hold true: larly, teamwork introduces students able: http://www.asha.org/public/speech/ development/child_hear_talk.htm. • Although a problem can be de- to the diff erent ways in which people Henze, N., & Nejdl, W. (1998). Constructiv- signed to require the implemen- approach programming problems and ism in computer science education: Evalu- tation of a certain algorithm or the various styles of writing code. Th e ating a teleteaching environment for proj- structure, the teacher should allow student should begin to recognize the ect oriented learning. Interactive Computer Aided Learning Concepts and Applications. his or her students to discover this most effi cient structures and make use Proceedings of the ICL 98 Workshop, Carin- on their own and to explore their of them when needed. Teamwork will thian Institute of Technology, Villach, Austria, own ideas. No requirements can introduce students to careers related October 1998. Available: http://citeseer. to computer science, where a whole ist.psu.edu/henze98constructivism.html be made that a program should Naigles, L. . (2002). Form is easy, meaning be written a certain way, although team can work together to write one is hard: Resolving a paradox in early child a runtime or memory-size limit software product. language. Cognition, 86, 157–199. could be enforced. By encouraging Stephenson, C. (2002). High school computer Achieving Fluency science education: A fi ve-state study. JCSE students to analyze the benefi ts and Online. Available: http://www.iste.org/ costs of implementing specifi c algo- With some practice, most students sigcs/community/jcseonline/2002/02/ste- rithms or solutions, they will fi nd can gain the skills needed to be phenson.cfm. out why longer programs or more profi cient in a useful programming Tucker, A. (1996). Strategic directions in computer science education. ACM complex solutions can lead to expo- language. Learning any language is Computing Surveys, 28(4), 836–845. nentially faster programs. diffi cult. It takes practice, study, and Van Roy, P., (2003). Th e role of language • Allow students to work together, the ability to apply several layers of paradigms in teaching programming. but make sure that they all contrib- abstraction to a concrete problem. A Technical Symposium on Computer Science Education, 34, 269–270. ute to the programming process. good lesson plan that relates code to Zanconi, M., Moroni, N., & Señas, P. (1995). Th is way, they will all gain pro- everyday life situations can make the An educational project in computer gramming experience. Student experience much easier. Learning to science for primary and high school. collaboration is crucial in encour- SigCSE Bulletin, 27, 27–33. aging understanding when teach- 1000 100010011 Justin Solomon is a 17-year- ers have exhausted the traditional old junior at Th omas Jeff erson means of instruction. Group proj- 1000 100010011 High School for Science and ects are especially important in Technology in Alexandria, OOP, where each member can be 1000 100010011 Virginia. He began program- ming after the third grade responsible for a single component 1000 100010011 and is currently studying arti- of a larger program. fi cial intelligence and computer graphics. Justin • Try to assign programs in order 1000 100010011 recently won fi rst place in the Fairfax County of their level of abstraction. Begin Regional and Virginia State Science and Engi- neering Fairs for computer science. He would like with programs that have an obvious 1000 100010011 to thank Joshua Strong, Karen Budd, Elizabeth implementation and then move on Lodal, Anita McAnear, and Philip East for their to applications of the specifi c struc- 1000 100010011 assistance in the development of this project.

December/January 2004–05 Learning & Leading with Technology 39 Copyright © 2004, ISTE (International Society for Technology in Education), 1.800.336.5191 (U.S. & Canada) or 1.541.302.3777 (Int’l), [email protected], www.iste.org. All rights reserved.