Reinforcing Grammar with Computer Programming

Dr. Tony McCaffrey

Computer programming classes have the untapped potential to reinforce many of the skills learned in other subjects. It is well known that if a student can teach someone else a task, then that student understands the task. A lesser known principle is that if a student can instruct a computer how to do a task then they really, really understand the task. The computer only does precisely what it is commanded to do. So, a student’s understanding must be thorough to get the computer also to do the task.
Writing a Program
Students in our intro programming classes are writing programs to generate grammatical sentences. Many students need work on their own grammar, but to write a program that follows English grammar amounts to a strong reinforcement of what they have learned in their English classes.

For example, make sure the subject and verb agree. Select the proper article to go with the word that follows (e.g., “an alligator,” not “a alligator). Of course, capitalize the first letter of the sentence and put the correct punctuation at the end. The students’ programs even turn declarative sentence into questions. For example, the following sentence is transformed into several questions: “The annoying mosquito bothered the people at our party.” “What bothered the people?” “A mosquito.” “What was the mosquito like?” “It was annoying.” “Where did this happen?” “At our party.” Their programs even put in the correct pronouns for the subject (e.g., “it” for “mosquito”).
Grammar Checks
These simple grammar checks exercise the students programming skills and bolster the basics of their writing skills. Of course, many more grammar checks could be programmed, but we are not trying to create the next Grammarly (i.e., a professional grammar checker). We are merely trying to strengthen students’ own understanding of grammar.
The same type of programming project can also work with other processes students are learning in other classrooms.

For example, write a program to simplify an algebraic expression. Write one to balance a chemical equation. Code up a program to translate basic sentences from English to another language. Again, if a student can program any of these tasks, then they deeply understand what they learned in another subject.

P.O. Box 116
242 Old Petersham Road
Hardwick, MA 01037
Phone: 413.477.6000
Fax: 413.477.6837

Eagle Hill School

Eagle Hill School is the premier college preparatory boarding and day school for students in grades 8-12 with diverse learning profiles, such as ADHD and Dyslexia.